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() doesn't save geom_raster() layer to a file #778

Closed
IKupriyanov-HORIS opened this issue May 5, 2023 · 2 comments
Closed

ggsave() doesn't save geom_raster() layer to a file #778

IKupriyanov-HORIS opened this issue May 5, 2023 · 2 comments
Assignees

Comments

@IKupriyanov-HORIS
Copy link
Collaborator

Code:

from lets_plot import *
from IPython.display import SVG

LetsPlot.setup_html()

data = {
    "x": [ -1.0, 1.0, -1.0, 1.0 ],
    "y": [ -1.0, -1.0, 1.0, 1.0 ],
    "z": [ 0.024, 0.094, 0.094, 0.024 ]
}
p = ggplot(data) + \
    geom_raster(aes(x='x', y='y', fill='z'), data=data) + \
    geom_point(aes(x='x', y='y'), size=5, data=data) + \
    scale_fill_gradient(low="#54278f", high="#f2f0f7")

print("Plot")
p.show()

print("Image")
plot_filename = ggsave(p, 'issue_ggsave_raster.svg')
display(SVG(plot_filename))

Result:
image

@alshan
Copy link
Collaborator

alshan commented May 5, 2023

There is no "portable" RGB encoder:

SvgToString(rgbEncoder = null) // data-frame --> rgb image is not supported (geom_raster)

@IKupriyanov-HORIS IKupriyanov-HORIS self-assigned this May 9, 2023
@alshan
Copy link
Collaborator

alshan commented May 10, 2023

Same issue when ggsaving geom_imshow (i.e. empty plot).

@alshan alshan added this to the 2023Q2 milestone May 10, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 5, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 5, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
RYangazov added a commit to RYangazov/lets-plot that referenced this issue Jun 8, 2023
@alshan alshan modified the milestones: 2023Q2, 2023Q3 Jun 28, 2023
@alshan alshan closed this as completed in d9b1019 Jul 10, 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