JuliaPlots / InspectDR.jl

Fast, interactive Julia/GTK+ plots (+Smith charts +Gtk widget +Cairo-only images)
MIT License
68 stars 9 forks source link

Strange results #9

Closed skanskan closed 7 years ago

skanskan commented 7 years ago

Hello.

I'm not sure whether this problem is caused by InspectDR or not.

I'm trying Plots.jl with several fast frameworks such as as GR and InspectDR.

When I run this code

using Plots
inspectdr()
plot(1:100,rand(100))

924f5fdb13ae4c5ae7bb948be768c2ac37301391_1_690x457

As you can see the Y-axis doesn't show the numbers properly, in Chrome nor on Firexox. If I save the plot with savefig("plot1.png") then it works well.

And something more strange

Why is this code scatter(1:10000,rand(10000))

producing this plot?

c0914df85acf9ae48f2fdbd659041c2b4eef529e

I mean, if I use scatter(1:100,rand(100)) instead then I get a plot with the dots well distributed but with higher numbers the dots accumulate on the top and the bottom.

I'm getting the same bad behaviour if I use the syntax display(plot(1:10000, rand(10000), seriestype=:scatter))

I'm using Julia v0.6, InspectDR v0.2.2 and Plots v0.12+ on Windows 10 x64 and Chrome 59

ma-laforge commented 7 years ago

Why do my numbers/labels not look right in Jupyter notebooks?

By default, InspectDR renders to SVG... but Jupyter does not appear to display SVGs correctly.

Therefore, you have to set the following variable:

InspectDR.defaults.rendersvg=false

Alternatively (preferably), you can add the following to your ~/.juliarc file:

DEFAULTS_INSPECTDR = Dict(
    :rendersvg => false,
)
skanskan commented 7 years ago

InspectDR.defaults.rendersvg=falseworks for the first plot but in the second one, the Y-axis in scatter(1:10000,rand(10000)) is still wrong.

And, adding

DEFAULTS_INSPECTDR = Dict(
    :rendersvg = false,
)

to juliarc produces an error when starting Julia. It says:

[I 15:15:06.915 NotebookApp] Creating new notebook in
[I 15:15:07.874 NotebookApp] Kernel started: 5b479fcc-b9cf-40d8-b319-ebb48cb88d5f
ERROR: LoadError: syntax: keyword argument is not a symbol: ":rendersvg"
Stacktrace:
 [1] include_from_node1(::String) at .\loading.jl:569
 [2] include(::String) at .\sysimg.jl:14
 [3] load_juliarc() at .\client.jl:317
 [4] process_options(::Base.JLOptions) at .\client.jl:275
 [5] _start() at .\client.jl:371
while loading C:\Program Files\Julia-0.6.0\etc\julia\juliarc.jl, in expression starting on line 6
[I 15:15:10.864 NotebookApp] KernelRestarter: restarting kernel (1/5)
ERROR: LoadError: syntax: keyword argument is not a symbol: ":rendersvg"
Stacktrace:
 [1] include_from_node1(::String) at .\loading.jl:569
and similar lines
ma-laforge commented 7 years ago

Sorry... line was: :rendersvg => false, (Fixed above)

ma-laforge commented 7 years ago

Why is this code [...] producing this plot?

That is very unfortunate - an oversight on my part.

InspectDR gets its speed on large datasets by dropping points that are not "visible". Instead, it "draws a glitch" to visually indicate that the data is within some y-range (this is what "F1-acceleration" is).

This works well on line art... but not so much when all you draw are symbols.

You can work around this by using setting dataf1=false when you "add" a dataset:

add(plot::Plot2D, x::Vector, y::Vector; id::String="", dataf1=true, strip=1)

Unfortunately, this is not available from Plots.jl.

I will have to find a workaround - and might need to rethink when I can actually apply "F1-acceleration".

I will keep you posted.

ma-laforge commented 7 years ago

@skanskan: InspectDR.defaults.rendersvg=falseworks for the first plot but in the second one, the Y-axis in scatter(1:10000,rand(10000)) is still wrong.

It is very odd that the first one plots correctly, but not the second one. I will have to investigate.

skanskan commented 7 years ago

@ma-laforge Thank you for you interest and work.

ma-laforge commented 7 years ago

Should be working now. Please re-open if this is not yet true.