Strange things with plots, InspectDR

question

#1

Hi.

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))

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?

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))


#2

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,
)

#3

@Juan: 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” does).

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

You can work around this by setting the parameter 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.


#4

@Juan: Why is this code […] producing this plot?

I just tagged a new version of InspectDR: v0.2.3.

It adds a new setting called :droppoints. See section “Configuration/Defaults” section for more info: https://github.com/ma-laforge/InspectDR.jl/tree/v0.2.3#Config_Defaults

In short, this setting inhibits “F1”-acceleration, depending on how a trace is drawn. By default, InspectDR will no longer apply “F1”-acceleration when data is displayed with glyphs (or markers - in Plots.jl-speak).

The unfortunate result of this change is that rendering of plots will be significantly slower for large datasets that are plotted with markers.


#5

Thanks,
I’ve added

DEFAULTS_INSPECTDR = Dict(
	:rendersvg => false,
	:droppoints => :never,
	)

to my juliarc.jl and now it works as expected.
And I think it’s still fast.
I need to compare it to other packages such as GR