You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'Modal Split' are my values of type integer.
Displaying the plot with p.show() shows the plot with correct integer values like 35 and 11.
Saving the same plot with ggsave(p, filename='filename.svg', path='.') as an svg file transforms the displayed modal split values to floats with one digit after the decimal point like 35.0 and 11.0.
Saving the same plot as html ggsave(p, filename='filename.html', path='.') is again perfectly fine with pure integer values.
Solution (Workaround):
Add label_format=".0f" to geom_text()
Right now I am not sure if this a weird special case due to faceting, stacking or flipping or if it is common for geom_text.
Tested with the current version 2.5.1
The text was updated successfully, but these errors were encountered:
This likely happens because in absence of an explicit formatting pattern we simply fall back on a default number formatting which is platform dependent.
In case of p.show() and ggsave(html) the platform is a JavaScript engine, but in case of ggsave(svg) the platform is your OS.
Apparently, they behave slightly differently.
Probably, a good solution for us would be to guess a good formatting pattern for geom_text() by analysing the data (similar to how it works in tooltips and on axis).
As least the result would be consistent across platforms.
Problem:
I have a (horizontal) stacked and grouped bar chart with the values displayed as text.
'Modal Split' are my values of type integer.
Displaying the plot with
p.show()
shows the plot with correct integer values like 35 and 11.Saving the same plot with
ggsave(p, filename='filename.svg', path='.')
as an svg file transforms the displayed modal split values to floats with one digit after the decimal point like 35.0 and 11.0.Saving the same plot as html
ggsave(p, filename='filename.html', path='.')
is again perfectly fine with pure integer values.Solution (Workaround):
Add
label_format=".0f"
togeom_text()
Right now I am not sure if this a weird special case due to faceting, stacking or flipping or if it is common for geom_text.
Tested with the current version 2.5.1
The text was updated successfully, but these errors were encountered: