Closed hffqyd closed 3 years ago
Hi,I'm writing to say that I happened to find a solution for this issue, while I still don't know why exactly.
I found adding scale_y_continuous()
as below would fix this.
import ggplotnim
var x = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
var y = [0.0, 0.0001, 0.0, 0.0, 0.0001, 0.0003, 0.0003, 0.0001, 0.0001, 0.0003, 0.0001, 0.0003, 0.0003, 0.0001, 0.0, 0.0003, 0.0001, 0.0, 0.0004, 0.0001, 0.0015, 0.0001, 0.0001, 0.0001, 0.0, 0.0003, 0.0]
let df = seqsToDf(x, y)
ggplot(df, aes("x", "y")) +
geom_line() +
scale_y_continuous() +
ggsave("gg.png")
While changinig scale_y_continuous()
to scale_y_discrete()
, it will just like before. It seems at some times the data was treated as discrete, is it?
Thank you for the great package. Wish it will be something like ggplot2 in R.
Hey! Sorry for not answering. I was on vacation without reception. :)
While changinig scale_y_continuous() to scale_y_discrete(), it will just like before. It seems at some times the data was treated as discrete, is it?
Yes, that is exactly what seems to be happening. I'm using some simple heuristics to automatically determine whether data looks continuous or discrete. The logic isn't that great though and it's problematic, because the user does not realize it's happening. I suppose I could echo an info line for the atypical cases, e.g. if float data is interpreted as discrete.
I'll leave this issue open for sure, since that's an important thing to fix.
This has been fixed in #118 by changing how floating point values are handled: they are considered continuous by default now.
Sorry to bother you again, but I encountered a problem when using
geom_line()
with some data, and the case was the same usinggeom_point()
, as in the code showed below.And the resulting plot would be:
However, sometimes with simillar data, for example, when deleted the last number in both
x
andy
, the y axis would be not reversed.Where was I wrong? Or if the data type was not right?