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

Default appearance of Plots.jl backend #11

Open
rafaqz opened this issue Nov 7, 2017 · 8 comments
Open

Default appearance of Plots.jl backend #11

rafaqz opened this issue Nov 7, 2017 · 8 comments

Comments

@rafaqz
Copy link

rafaqz commented Nov 7, 2017

First I would like to say thanks for this package! From my tests of live updating plots of large datasets with multiple subplots this is by far the fastest of any of the Plots.jl backends. It seems to be the best solution for the visualizations I'm doing.

But it also renders plots very differently to the other Plots.jl backends. The subplot margins are very wide, meaning I have much less screen space. The heavyness of the grid background is a little distracting when doing live visualizations in a notebook. These are probably modifiable somehow but breaks the easy backend swapping I'm used to in Plots. Would it be possible to set defaults that look closer to plotly or gr?

@rafaqz rafaqz changed the title Appearance Default appearance of Plots.jl backend Nov 7, 2017
@ma-laforge
Copy link
Owner

About speed

Interesting. Did you find it was faster than the currenty implementation of GR? By approximately how much? (I have had very few real-world feedback on this subject).

About subplot margins

I think this might be because InspectDR has limited control over legends. It only supports legends on the right hand side for the moment. You can either disable it completely, or reduce the allocated width for the legend:

Controlling legends of a Plot2D object directly

plot.layout[:enable_legend] = false #Disable legend
plot.layout[:halloc_legend] = 150 #Control width of legend

Controlling legends from InspectDR defaults

Add the following to your ~/.juliarc.jl file:

DEFAULTS_INSPECTDR = Dict(
	:enable_legend => false, #Disable legend
	#AND/OR
	:halloc_legend => 150, #Control width of legend
)

Controlling grid thickness

It is on my TODO list, but I have not yet had much time to think about how to re-structure the code to allow this. Partially because I have not had the time - and partially because my userbase is still a bit small for me to allocate more time on less critical features (for me).

Quick hack

For the time being, you can tweak the grid appearence by changing a line in the src/grids.jl file:

const GRID_MAJOR_LINE = LineStyle(
	:dash, Float64(2), RGB24(.7, .7, .7)
)
const GRID_MINOR_LINE = LineStyle(
	:dash, Float64(1), RGB24(.7, .7, .7)
)

Right now, the major grid line is 2 Points wide... you can use fractional point sizes (ex: Float64(0.5)) if you wish.

Please be aware that modifying the code keeps you from getting updates of InspectDR (The code must be restored to its original state for the package manager to perform the update).

@rafaqz
Copy link
Author

rafaqz commented Nov 8, 2017

Thanks for the quick response, I'll try those out.

GR is great until I use really large arrays, at which point it's considerably slower than even plotly. I was about to start issue for that over at gr - I'm sure there is some way of thinning the data but I haven't found it yet. But even in normal performance this backend has the smoothest refresh rate in a Jupyter notebook. It might be better if the work goes into the gr issue given the graphical limitations of InspectDR, but its definitely doing something right in terms of speed with large datasets.

@rafaqz
Copy link
Author

rafaqz commented Nov 8, 2017

It's really much better with lighter gridlines - something like this:

const GRID_MAJOR_LINE = LineStyle(
	:solid, Float64(1), RGB24(.8, .8, .8)
)
const GRID_MINOR_LINE = LineStyle(
	:solid, Float64(0.5), RGB24(.8, .8, .8)
)

@rafaqz
Copy link
Author

rafaqz commented Nov 9, 2017

I only just realised interactDR is written all in julia! If you need help improving the appearance I might have some time to chip in, I think I'm settling on using this as my main graphing tool as my core need is fast line plotting inside notebooks with Plots.jl integration. It would be great to have full control of the appearance through Plots.jl.

@ma-laforge
Copy link
Owner

@rafaqz: I was about to start issue for that over at gr [...]

I'm all for that. I did not build InspectDR for the pure fun of it - I started it out of frustration because none of the plotting tools out there satisfied my requirements.

I would much prefer it if the other tools out there would be better in terms of speed/interactivity.

That way, I would not have to "waste" cycles developing tools just to do my work.

@ma-laforge
Copy link
Owner

@rafaqz: It's really much better with lighter gridlines [...]

A valid point - but I prefer thicker lines because they are more legible when plots are included in journal/conference publications.

At the end of the day, this setting should probably be added the PlotLayout structure in src/base.jl.

The entry should be something similar to the frame_canvas attribute... Possibly using the names:

line_gridmajor
line_gridminor

That way, the defaults can be overwritten through the user's ~/.juliarc.jl file.

Probably not that complicated to refactor - but I might not have time to address this for a week or two.

@ma-laforge
Copy link
Owner

Update:

I just added user control of grid lines. Unfortunately, this control requires the definition of LineStyle that exists in InspectDR (Not available when ~/.juliarc.jl is executed).

As a consequence, you will probably want to change the default InspectDR grid lines using something like the following:

using InspectDR
InspectDR.defaults.plotlayout.line_gridmajor=InspectDR.LineStyle(:solid, Float64(1), Colors.RGB24(.8, .8, .8))
InspectDR.defaults.plotlayout.line_gridminor=InspectDR.LineStyle(:solid, Float64(0.5), Colors.RGB24(.8, .8, .8))

Though a bit verbose, the good news is that you could create a wrapper function to setup this configuration before you start plotting. You could even create a wrapper module (let's call it CustomPlotting) that would load up Plots.jl, InspectDR.jl, etc & pre-configure everyting the way you like.

NOTE:

@ma-laforge
Copy link
Owner

New version of InspectDR got tagged.

Perform a Pkg.update() and try to overwrite the grid format as described above.

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