User Tools

Site Tools


plotattributes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

plotattributes [2018/12/27 13:27] (current)
Line 1: Line 1:
 +
 +
 +~~TOC 1-3 wide~~
 +
 +---
 +
 +^  [[plotting|Plotting Introduction]] ​ ^  [[plotattributes|Plot Attributes]] ​ ^  [[plotgallery2d|2-D Gallery]] ​ ^  [[plotgallery3d|3-D Gallery]] ​ ^
 +
 +---
 +
 +
 +```juliaeval
 +julia> pkgchk.( [ "​julia"​ => v"​1.0.3",​ "​Plots"​ => v"​0.21.0"​ ] );
 +
 +```
 +
 +
 +# 2-D Plot Gallery
 +
 +WARNING Some of the attributes in the Plots package still have some bugs, but Plots is maturing quickly.
 +
 +## Basic Overall Introduction
 +
 +### Base Figure
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y )
 +savefig( "​plotting/​base.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{base.png}} ​ |  {{base.png}} ​ |
 +
 +###  Overall Font
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, fontfamily=font(48,​ "​Courier"​) );
 +savefig( "​plotting/​fontfamily.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{fontfamily.png}} ​ |  {{base.png}} ​ |
 +
 +### Overall Plot Area Color
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, background_color=:​lightgray,​ background_color_outside=:​yellow,​
 +        foreground_color=:​blue,​ background_color_legend=:​green );
 +savefig( "​plotting/​ground_color.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{ground_color.png}} ​ |  {{base.png}} ​ |
 +
 +* Not Shown: `background_color_inside` and `background_color_subplot`,​ `foreground_color_subplot`,​
 +
 +###  Plot Title
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, plot_title="​Plot Title" )
 +savefig( "​plotting/​plot_title.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{plot_title.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, title="​Plot Title" )
 +savefig( "​plotting/​title.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{title.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot(x, Y, title="​MyTitle",​ title_location=:​left,​ titlefontcolor=:​blue,​ titlefontfamily=:​Courier,​ titlefontsize=30 )
 +savefig( "​plotting/​titlemany.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{titlemany.png}} ​ |  {{base.png}} ​ |
 +
 +The following title-related attributes are either not working or are mysteries to me:
 +
 +* plot( x, Y, titlefonthalign=);​ savefig( "​plotting/​ titlefonthalign.png"​ );
 +
 +* plot( x, Y, titlefontrotation=);​ savefig( "​plotting/​ titlefontrotation.png"​ );  ## bug
 +
 +* plot( x, Y, titlefontvalign=);​ savefig( "​plotting/​ titlefontvalign.png"​ );
 +
 +* plot( x, Y, foreground_color_title=);​savefig( "​plotting/​ foreground_color_title.png"​ );
 +
 +###  Margins
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +using Measures
 +plot(x,Y, margin=10mm )
 +savefig( "​plotting/​margins.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{margins.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +using Measures
 +plot(x,Y, left_margin=-20pt,​ right_margin=20mm,​ top_margin=0.5inch )  ## note---on the left, we extend outside
 +savefig( "​plotting/​marginsvaried.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{marginsvaried.png}} ​ |  {{base.png}} ​ |
 +
 +##  Series Line Styles
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, linealpha=0.5,​ linecolor=[:​blue :green], linestyle=[ :solid :dot], linewidth=[5 2]  )
 +savefig( "​plotting/​linebluegreen.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{linebluegreen.png}} ​ |  {{base.png}} ​ |
 +
 +### WARNING Multiple Series'​ Attributes Must be Passed as Matrix, Not as Vector
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +pl= plot( x, Y, linecolor=[:​black,:​red],​ linewidth=[5,​3] ​ );
 +pr= plot( x, Y, linecolor=[:​black :red], linewidth=[5 3]  );
 +plot( pl, pr, layout=2 )
 +savefig( "​plotting/​rightwrong.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{rightwrong.png}} ​ |  {{base.png}} ​ |
 +
 +The left is probably not what you expected. ​ The problem is that on each point, the linecolors cycle through their values. ​ The arguments on the right are matrices (not vectors), because they are space separated.
 +
 +##  Legend
 +
 +### Naming Series
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, label=[ "​sin",​ "​cos"​ ] );
 +savefig( "​plotting/​label.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{label.png}} ​ |  {{base.png}} ​ |
 +
 +### Not Printing Legend
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, legend=false);​
 +savefig( "​plotting/​nolegend.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{nolegend.png}} ​ |  {{base.png}} ​ |
 +
 +`plot( x, Y, legendfontcolor=:​blue);​ savefig( "​plotting/​legendfontcolor.png"​ );` fails with error about alpha
 +
 +### Legend Font Family / Rotation /Size
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, legendfontfamily=:​Courier);​
 +savefig( "​plotting/​legendfontfamily.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{legendfontfamily.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, legendfontrotation=45); ​  ## this is a bug
 +savefig( "​plotting/​legendfontrotation.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{legendfontrotation.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, legendfontsize=6);​
 +savefig( "​plotting/​legendfontsize.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{legendfontsize.png}} ​ |  {{base.png}} ​ |
 +
 +### Legend Title
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, legendtitle="​Legend Title"​);​
 +savefig( "​plotting/​legendtitle.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{legendtitle.png}} ​ |  {{base.png}} ​ |
 +
 +### Legend Color
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, foreground_color_legend=:​red);​
 +savefig( "​plotting/​foreground_color_legend.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{foreground_color_legend.png}} ​ |  {{base.png}} ​ |
 +
 +## Adding Features
 +
 +### Text Annotations
 +
 +```juliaeval
 +
 +using Plots
 +plot( x, Y, annotations=[ (3,-0.5, "at 3 and -0.5"​),​ (6,​-1,"​at 6 and -1") ] );
 +plot!(; annotations=[ (3,0.25, text("​larger text",​20)) ] );
 +savefig( "​plotting/​annotations.png"​ )
 +
 +```
 +
 +{{annotations.png}}
 +
 +### Regression Lines
 +
 +```juliaeval
 +
 +using Plots; x=0.0 : 0.05 : 1; Y= x.^2
 +scatter( x, Y, smooth=true );
 +savefig( "​plotting/​smoothregline.png"​ );  ## add a regression line
 +
 +```
 +
 +{{smoothregline.png}}
 +
 +### Error Bars
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.05 : 1; Y=[ x.^2, x.^4 ];
 +plot( x, Y, xerror=abs.(x ./ 10));
 +savefig( "​plotting/​xerror.png"​ );
 +
 +```
 +
 +{{xerror.png}}
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.05 : 1; Y=[ x.^2, x.^4 ];
 +plot( x, Y, yerror=[abs.(x./​10) abs.(x./​100)]);​
 +savefig( "​plotting/​yerror.png"​ );
 +
 +```
 +
 +{{yerror.png}}
 +
 +### Filling of Areas
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot(x, Y, fillrange=0,​ fillalpha=0.5,​ fillcolor=[ :red :blue ]);  ## the fillrange of 0 means start from x=0 up to line
 +savefig( "​plotting/​fillarea1.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{fillarea1.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot(x, sqrt.(x), fillrange=x,​ fillalpha=0.5,​ fillcolor=[:​red],​ legend=false) ​ ## from .(x) to sqrt.(x)
 +savefig( "​plotting/​fillarea2.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{fillarea2.png}} ​ |  {{base.png}} ​ |
 +
 +### Arrows
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, arrow=true );
 +savefig( "​plotting/​arrow.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{arrow.png}} ​ |  {{base.png}} ​ |
 +
 +Arrows are more useful in the context of quiver plots, illustrated in [[plotgallery3d|3-D Gallery]].
 +
 +##  Plot Resolution and Size
 +
 +###  DPI
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, dpi=72 );
 +savefig( "​plotting/​dpi72.png"​ );  ## default=100
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{dpi72.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots;
 +x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, dpi=36 )
 +savefig( "​plotting/​dpi36.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{dpi36.png}} ​ |  {{base.png}} ​ |
 +
 +###  Size (Pixel Resolution)
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10;  Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, size=[1200,​300] ); ## note: a tuple (like size=(1200,​300)) would also work
 +savefig( "​plotting/​size.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{size.png}} ​ |  {{base.png}} ​ |
 +
 +###  Aspect Ratios
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, aspect_ratio=6 );
 +savefig( "​plotting/​aspect_ratio.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{aspect_ratio.png}} ​ |  {{base.png}} ​ |
 +
 +## Frames and Thickness
 +
 +###  Thickness Scaling
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, thickness_scaling=4 );
 +savefig( "​plotting/​thickness_scaling4.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{thickness_scaling4.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, thickness_scaling=2 );
 +savefig( "​plotting/​thickness_scaling2.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{thickness_scaling2.png}} ​ |  {{base.png}} ​ |
 +
 +###  Frame Styles
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10;
 +p1= plot( x, Y, framestyle=:​axis );
 +p2= plot( x, Y, framestyle=:​semi );
 +p3= plot( x, Y, framestyle=:​none );
 +p4= plot( x, Y, framestyle=:​grid );
 +plot( p1, p2, p3, p4, layout=4 )
 +savefig( "​plotting/​framestyle.png"​ );
 +
 +```
 +
 +{{framestyle.png}}
 +
 +### Not Showing Axes (Plot Borders)
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, showaxis=false );
 +savefig( "​plotting/​showaxisfalse.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{showaxisfalse.png}} ​ |  {{base.png}} ​ |
 +
 +## Plot Range (X and Y Axes Plot Limits)
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, xlim=[0.1,​5],​ ylim=[-0.5,​2.0] );
 +savefig( "​plotting/​lim.png"​ );  ## lims
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{lim.png}} ​ |  {{base.png}} ​ |
 +
 +## Axes
 +
 +###  Axes to Log Scale
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, xscale=:​log10 );
 +savefig( "​plotting/​scale-log10.png"​ );  # depending on the backend, could also be xaxis=:log2 :ln
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{scale-log10.png}} ​ |  {{base.png}} ​ |
 +
 +### Flipping Axes
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ x.^2, sqrt.(x) ];
 +plot( plot( x, Y, yflip=true ), plot( x, Y, xflip=true ),  layout=2 )
 +savefig( "​plotting/​flip.png"​ );
 +
 +```
 +
 +{{flip.png}}
 +
 +### Mirroring Axes
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, xmirror=true );
 +savefig( "​plotting/​mirror.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{mirror.png}} ​ |  {{base.png}} ​ |
 +
 +###  Axis Color
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, foreground_color_axis=:​blue );
 +savefig( "​plotting/​foreground_color_axis.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{foreground_color_axis.png}} ​ |  {{base.png}} ​ |
 +
 +##  Axes Labels (Guides)
 +
 +The native name for axis label in Julia is "​guide"​.
 +
 +### Axis Label Color
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, guide="​Axes Values",​ guidefontcolor=:​red );
 +savefig( "​plotting/​guidefontcolor.png"​ )
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{guidefontcolor.png}} ​ |  {{base.png}} ​ |
 +
 +### Axis Label Font
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, guide="​Axes Values",​ guidefontfamily=font("​Times"​) );
 +savefig( "​plotting/​guidefontfamily.png"​ )
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{guidefontfamily.png}} ​ |  {{base.png}} ​ |
 +
 +### Axis Label Font Size
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, guide="​Axes Values",​ guidefontsize=24 );
 +savefig( "​plotting/​guidefontsize.png"​ )
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{guidefontsize.png}} ​ |  {{base.png}} ​ |
 +
 +##  Major and Minor Grids
 +
 +For better visibility, the next few plots switch to blue color and greater line width, too.
 +
 +### Major Grid Color and Line Width
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, grid=true, foreground_color_grid=:​blue,​ gridlinewidth=2 );
 +savefig( "​plotting/​grid.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{grid.png}} ​ |  {{base.png}} ​ |
 +
 +### Major Grid Alpha
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, grid=true, gridalpha=0.5,​ foreground_color_grid=:​blue,​ gridlinewidth=2 );
 +savefig( "​plotting/​gridalpha.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{gridalpha.png}} ​ |  {{base.png}} ​ |
 +
 +### Major Grid Style
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, gridstyle=:​solid,​ gridlinewidth=2 );
 +savefig( "​plotting/​gridstylesolid.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{gridstylesolid.png}} ​ |  {{base.png}} ​ |
 +
 +### Minor Grid
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, foreground_color_grid=:​blue,​ gridlinewidth=2,​ minorgrid=true,​ minorgridalpha= 1.0,
 +         ​foreground_color_minor_grid=:​red,​ minorgridlinewidth=3 );
 +savefig( "​plotting/​minor_grid.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{minor_grid.png}} ​ |  {{base.png}} ​ |
 +
 +## Tick Marks
 +
 +### No Axes Tickmarks
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, ticks=false );
 +savefig( "​plotting/​ticksfalse.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{ticksfalse.png}} ​ |  {{base.png}} ​ |
 +
 +### Axes Tickmarks at Specialized Locations
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +xloc= [3,5,7]; xlab= ["​three",​ "​five",​ "​seven"​];​
 +plot( x, Y, xticks= (xloc,xlab) )
 +savefig( "​plotting/​tickscustom.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{tickscustom.png}} ​ |  {{base.png}} ​ |
 +
 +* if you want only one tick, you must use `plot!( xticks= (3.0, ["​three"​]) )`.  If you do not place the "​three"​ into an array, it is interpreted as a character array, and only the '​t'​ is printed.
 +
 +### Moving Tickmarks inside the Graph
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, tick_direction=:​in );
 +savefig( "​plotting/​tick_direction.png"​ ); # ticks move inside the graphs (ticklabels stay outside)
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{tick_direction.png}} ​ |  {{base.png}} ​ |
 +
 +### Changing Tickmarks Color
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, foreground_color_text=:​blue );
 +savefig( "​plotting/​foreground_color_text.png"​ );  ## claims to apply to tick labels
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{foreground_color_text.png}} ​ |  {{base.png}} ​ |
 +
 +### Removing Minor Tickmarks
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, minorticks=true );
 +savefig( "​plotting/​minorticks.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{minorticks.png}} ​ |  {{base.png}} ​ |
 +
 +## Tick Labels
 +
 +###  Tick Label Color
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, tickfontcolor=:​blue);​
 +savefig( "​plotting/​tickfontcolor.png"​ );  # ticklabels
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{tickfontcolor.png}} ​ |  {{base.png}} ​ |
 +
 +### Change Tick Label Font
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, tickfontfamily=font("​Times"​) );
 +savefig( "​plotting/​tickfontfamily.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{tickfontfamily.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, tickfontsize=18 );
 +savefig( "​plotting/​tickfontsize.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{tickfontsize.png}} ​ |  {{base.png}} ​ |
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, xtickfont=font(24,​ "​Courier"​),​ ytickfont=font(6,​ "​Courier"​) );
 +savefig( "​plotting/​tickfont.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{tickfont.png}} ​ |  {{base.png}} ​ |
 +
 +### Rotate Tick Labels
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, xrotation=45,​ yrotation=90 );
 +savefig( "​plotting/​rotation.png"​ );  # rotation of tick labels
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{rotation.png}} ​ |  {{base.png}} ​ |
 +
 +###  Axes Tick Labels to Scientific Notation
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10; Y=[ sin.(x), cos.(x) ];
 +plot( x, Y, formatter=:​scientific );
 +savefig( "​plotting/​formatter.png"​ );
 +
 +```
 +
 +
 +^  This Graph  ^  Compare to Base  ^
 +|  {{formatter.png}} ​ |  {{base.png}} ​ |
 +
 +##  Layouts For Multiple Graphs
 +
 +```juliaeval
 +
 +using Plots; x=1 : 0.1 : 10;
 +p1= plot( x, x );
 +p2= plot( x, sin.(x) );
 +p3= plot( x, cos.(x) );
 +p4= plot( x, tan.(x) );
 +plot( p1, p2, p3, p4, layout=4 )
 +savefig( "​plotting/​layout.png"​ );
 +
 +```
 +
 +{{layout.png}}
 +
 + * To change the size of the figures, use `size=[800,​400]` on any one of them.  The others will be scaled to be similar.
 +
 +* A `size=` parameter on the final plot does not scale up or down the internal figures, but leaves more or less space between the figures.
 +
 +Not sure about the following parameters:
 +
 +  * plot( x, Y, subplot_index=int);​savefig( "​plotting/​subplot_index.png"​ ) allows specifying an index. ​ not sure how to use
 +
 +  * plot( x, Y, fontfamily_subplot=);​savefig( "​plotting/​ fontfamily_subplot.png"​ );
 +
 +  * plot( x, Y, link=);​savefig( "​plotting/​ link.png"​ ); link axis across subplots
 +
 +# Backmatter
 +
 +## Unknown or Unillustrated Parameters
 +
 +### not illustrated
 +
 +The following are plot parameters that have not been illustrated:​
 +
 +* plot( x, Y, overwrite_figure=false ); savefig( "​plotting/​.png"​ ); ## start a new figure
 +
 +* plot( x, Y, display_type=:​auto );savefig( "​plotting/​.png"​ );  # :auto, :gui, :inline
 +
 +* plot( x, Y, extra_kwargs ); savefig( "​plotting/​.png"​ );   # pass arguments to a backend.
 +
 +* plot( x, Y, html_output_format ); savefig( "​plotting/​.png"​ );  # could be svg or png for
 +
 +* plot( x, Y, inset_subplots ); savefig( "​plotting/​.png"​ );  # vector of bounding box
 +
 +* plot( x, Y, link=:y ); savefig( "​plotting/​.png"​ ); ## link the axes between subplots
 +
 +* plot( x, Y, pos ); savefig( "​plotting/​.png"​ );  ## unimplemented location of plot within window
 +
 +* plot( x, Y, show ); savefig( "​plotting/​.png"​ );  ## automatic redisplay
 +
 +* plot( x, Y, window_title ); savefig( "​plotting/​.png"​ );
 +
 +### unknown
 +
 +### questions
 +
 +* show to auto-plot zero-axis and change their color
 +
 +* plot( x, Y, xlabel="​x values",​ ylabel="​y values"​);​
 +
 +## Commonly Useful Packages on Julia Repository
 +
 +## Notes
 +
 +## References
 +
 +
 +
 +---
 +
 +WARNING Do not edit this page.  It is autogenerated from `plotattributes.jl` with `mkplotgallerytxt.pl`. ​ The plots themselves are generated by running the julia files themselves.
 +
  
plotattributes.txt ยท Last modified: 2018/12/27 13:27 (external edit)