Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggsave: saving geomImshow() to SVG produces fuzzy picture #188

Closed
alshan opened this issue May 10, 2023 · 4 comments
Closed

ggsave: saving geomImshow() to SVG produces fuzzy picture #188

alshan opened this issue May 10, 2023 · 4 comments
Assignees
Milestone

Comments

@alshan
Copy link
Collaborator

alshan commented May 10, 2023

Try ggsave the last plot in image_101.ipynb to svg :

image

Saving to HTML is fine.

@alshan alshan added this to the 2023Q2 milestone May 10, 2023
@alshan
Copy link
Collaborator Author

alshan commented May 10, 2023

Same issue in Python LP.

@alshan
Copy link
Collaborator Author

alshan commented May 10, 2023

In prev. LP v3.1.0 (py) saving imshow to SVG worked producing sharp images.

@IKupriyanov-HORIS
Copy link
Collaborator

Test notebook:

%use lets-plot
%use lib-ext

LetsPlot.getInfo()

//%

import java.awt.image.*
import javax.imageio.*
import java.nio.file.*

fun display(path: String): Any {
    if (path.endsWith("svg")) {
        val svg = Files.readString(Path.of(path))
        return HTML(svg)
    } else {
        val img = ImageIO.read(File(path))
        return Image(img)
    }
}

//%

val A2x3x4 = RasterData.create(
    listOf(
        listOf(
            listOf(1.0, 0.0, 0.0, 1.0), listOf(0.0, 1.0, 0.0, 1.0), listOf(0.0, 0.0, 1.0, 1.0)
        ),
        listOf(
            listOf(0.0, 1.0, 0.0, 0.3), listOf(0.0, 0.0, 1.0, 0.3), listOf(1.0, 0.0, 0.0, 0.3)
        )
    )
)

//%

val p = ggplot() + geomImshow(A2x3x4)
p.show()

//%

display(ggsave(p, "LPK-188.svg"))

//%

display(ggsave(p, "LPK-188.png"))

@alshan alshan modified the milestones: 2023Q2, 2023Q3 Jun 28, 2023
@alshan
Copy link
Collaborator Author

alshan commented Aug 24, 2023

Fixed in 4.4.2

@alshan alshan closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants