Plots.jl: How to change grid appearance in pyplot()?

Created on 24 Feb 2017  路  6Comments  路  Source: JuliaPlots/Plots.jl

Hello all!,

I can't figure out why I always get straight lines instead of dashed lines for the grids with pyplot() backend. To the left I show the plot that's used as an example at juliaplots.github, and to the right is the plot I get with the same code (and any other plotting command). With other backends I get the normal dashed line that looks much better.

Thanks!

grid

Most helpful comment

Use the keyword arg foreground_color_grid and assign it to lightgrey may alleviate the issue, e.g.

plot(x, y, foreground_color_grid=:lightgrey)

But I couldn't find a way to change the linestyle of the grid to be dot.

All 6 comments

I'll add that I'm trying to figure this out too. It only happened recently and I'm not sure if it was conda update or Pkg.update that caused it. For now I just initialize with pyplot(grid=false).

Use the keyword arg foreground_color_grid and assign it to lightgrey may alleviate the issue, e.g.

plot(x, y, foreground_color_grid=:lightgrey)

But I couldn't find a way to change the linestyle of the grid to be dot.

There doesn't seem to be a keyword to set the grid style. Here is what you can do.

Set defaults for grid by setting the following values in your matplotlibrc file:

### GRIDS
grid.color       :   d3d3d3    # grid color
grid.linestyle   :   :         # solid
grid.linewidth   :   0.5       # in points
grid.alpha       :   0.5       # transparency, between 0.0 and 1.0

I'm using matplotlib 2.0. It appears the default matplotlibrc file has the grid lines being solid.

@jgbos I'm also using matplotlib 2.0 but its default appearance on my system has no grid.

Closed by #721 but see the discussion there for a recommended enhancement.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nebuta picture nebuta  路  3Comments

Cody-G picture Cody-G  路  4Comments

lstagner picture lstagner  路  5Comments

daschw picture daschw  路  3Comments

ereday picture ereday  路  3Comments