Plots Julia Contour 7,5/10 4889 reviews
In Plots, input data is passed positionally (for example, the y
in plot(y)
), and attributes are passed as keywords (for example, plot(y, color = :blue)
). Most of the information on this page is available from your Julia REPL. After one executes, using Plots
in the REPL, one can use the function plotattr()
to print a list of all attributes for either series, plots, subplots, or axes.
- Julia Meshgrid
- Plots Julia Contour
- Contour Plot Online
- Julia Bar Plot
Once you acquire the list of attributes, you can either use the aliases of a specific attribute or investigate a specific attribut to print that attribute's aliases and its description.
Do not forget to enclose the attribute you are attempting to use with double quotes!
Keywords can take a range of values through the alias mechanic. For example, plot(y, color = :blue)
is really interpreted as plot(y, seriescolor = :blue)
. Each attribute has a number of aliases (see the charts below), which are available to avoid the pain of constantly looking up plotting API documentation because you forgot the argument name. c
, color
, and seriescolor
all mean the same thing, and in fact those are eventually converted into the more precise attributes linecolor
, markercolor
, markerstrokecolor
, and fillcolor
(which you can then override if desired).
- Text meshscatter scatter mesh linesegments lines surface volume heatmap image interaction record statsmakie vbox layout legend colorlegend vectorfield poly camera.
- Plot multiple series with different numbers of points. Mix arguments that apply to all series (marker/markersize) with arguments unique to each series (colors). Special arguments line, marker, and fill will automatically figure out what arguments to set (for example, we are setting the linestyle, linewidth, and color arguments with line.).
Plotting options in Julia I PyPlot(our recommendation) JuliaBoxsupports PyPlot PyPlotcan be made to run locally (but it’s not straightforward) I other options (not recommended): Plots, Gadfly 2. Fire up JuliaBox I head to login I once you login, you will see a.
Use aliases for one-off analysis and visualization, but use the true keyword name for long-lived library code to avoid confusion.
As of this writing, aliases do not work inside recipes!!
Some arguments encompass smart shorthands for setting many related arguments at the same time. Plots uses type checking and multiple dispatch to smartly 'figure out' which values apply to which argument. Pass in a tuple of values. Single values will be first wrapped in a tuple before processing.
Passing a tuple of settings to the xaxis
argument will allow the quick definition of xlabel
, xlims
, xticks
, xscale
, xflip
, and xtickfont
. The following are equivalent:
Note that yaxis
and zaxis
work similarly, and axis
will apply to all.
Passing a tuple to xticks
(and similarly to yticks
and zticks
) changes the position of the ticks and the labels:
Set attributes corresponding to a series line. Aliases: l
. The following are equivalent:
Set attributes corresponding to a series fill area. Aliases: f
, area
. The following are equivalent:
Set attributes corresponding to a series marker. Aliases: m
, mark
. The following are equivalent:
Julia Meshgrid
This is a collection of some notable arguments that are not well-known:
Plot contours.
Call signature:
Plots Julia Contour
contour
and contourf
draw contour lines and filled contours,respectively. Except as noted, function signatures and return valuesare the same for both versions.
Parameters: | - X, Y:array-like, optional
The coordinates of the values in Z. X and Y must both be 2-D with the same shape as Z (e.g.created via numpy.meshgrid ), or they must both be 1-D suchthat len(X)M is the number of columns in Z andlen(Y)N is the number of rows in Z. If not given, they are assumed to be integer indices, i.e.X=range(M) , Y=range(N) . - Z:array-like(N, M)
The height values over which the contour is drawn. - levels:int or array-like, optional
Determines the number and positions of the contour lines / regions. If an int n, use n data intervals; i.e. draw n+1 contourlines. The level heights are automatically chosen. If array-like, draw contour lines at the specified levels.The values must be in increasing order.
|
---|
Returns: | - c:
QuadContourSet
|
---|
Other Parameters: | - corner_mask:bool, optional
Enable/disable corner masking, which only has an effect if Z isa masked array. If False , any quad touching a masked point ismasked out. If True , only the triangular corners of quadsnearest those points are always masked out, other triangularcorners comprising three unmasked points are contoured as usual. Defaults to rcParams['contour.corner_mask']=True , which defaults to True . - colors:color string or sequence of colors, optional
The colors of the levels, i.e. the lines for contour and theareas for contourf . The sequence is cycled for the levels in ascending order. If thesequence is shorter than the number of levels, it's repeated. As a shortcut, single color strings may be used in place ofone-element lists, i.e. 'red' instead of ['red'] to colorall levels with the same color. This shortcut does only work forcolor strings, not for other ways of specifying colors. By default (value None), the colormap specified by cmapwill be used. - alpha:float, optional
The alpha blending value, between 0 (transparent) and 1 (opaque). - cmap:str or
Colormap , optional A Colormap instance or registered colormap name. The colormapmaps the level values to colors.Defaults to rcParams['image.cmap']='viridis' . If both colors and cmap are given, an error is raised. - norm:
Normalize , optional If a colormap is used, the Normalize instance scales the levelvalues to the canonical colormap range [0, 1] for mapping tocolors. If not given, the default linear scaling is used. - vmin, vmax:float, optional
If not None, either or both of these values will be supplied tothe Normalize instance, overriding the default color scalingbased on levels. - origin:{None, 'upper', 'lower', 'image'}, optional
Determines the orientation and exact position of Z by specifyingthe position of Z[0,0] . This is only relevant, if X, Yare not given. - None:
Z[0,0] is at X=0, Y=0 in the lower left corner. - 'lower':
Z[0,0] is at X=0.5, Y=0.5 in the lower left corner. - 'upper':
Z[0,0] is at X=N+0.5, Y=0.5 in the upper leftcorner. - 'image': Use the value from
rcParams['image.origin']='upper' .
- extent:(x0, x1, y0, y1), optional
If origin is not None, then extent is interpreted as inimshow : it gives the outer pixel boundaries. In this case, theposition of Z[0,0] is the center of the pixel, not a corner. Iforigin is None, then (x0, y0) is the position of Z[0,0],and (x1, y1) is the position of Z[-1,-1]. This argument is ignored if X and Y are specified in the callto contour. - locator:ticker.Locator subclass, optional
The locator is used to determine the contour levels if theyare not given explicitly via levels.Defaults to MaxNLocator . - extend:{'neither', 'both', 'min', 'max'}, optional, default: 'neither'
Determines the contourf -coloring of values that are outside thelevels range. If 'neither', values outside the levels range are not colored.If 'min', 'max' or 'both', color the values below, above or belowand above the levels range. Values below min(levels) and above max(levels) are mappedto the under/over values of the Colormap . Note, that mostcolormaps do not have dedicated colors for these by default, sothat the over and under values are the edge values of the colormap.You may want to set these values explicitly usingColormap.set_under and Colormap.set_over . Note An exising QuadContourSet does not get notified ifproperties of its colormap are changed. Therefore, an explicitcall QuadContourSet.changed() is needed after modifying thecolormap. The explicit call can be left out, if a colorbar isassigned to the QuadContourSet because it internally callsQuadContourSet.changed() . Example: - xunits, yunits:registered units, optional
Override axis units by specifying an instance of amatplotlib.units.ConversionInterface . - antialiased:bool, optional
Enable antialiasing, overriding the defaults. Forfilled contours, the default is True. For line contours,it is taken from rcParams['lines.antialiased']=True . - Nchunk:int >= 0, optional
If 0, no subdivision of the domain. Specify a positive integer todivide the domain into subdomains of nchunk by nchunk quads.Chunking reduces the maximum length of polygons generated by thecontouring algorithm which reduces the rendering workload passedon to the backend and also requires slightly less RAM. It canhowever introduce rendering artifacts at chunk boundaries dependingon the backend, the antialiased flag and value of alpha. - linewidths:float or sequence of float, optional
Only applies tocontour . The line width of the contour lines. If a number, all levels will be plotted with this linewidth. If a sequence, the levels in ascending order will be plotted withthe linewidths in the order specified. Defaults to rcParams['lines.linewidth']=1.5 . - linestyles:{None, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
Only applies tocontour . If linestyles is None, the default is 'solid' unless the linesare monochrome. In that case, negative contours will take theirlinestyle from rcParams['contour.negative_linestyle']='dashed' setting. linestyles can also be an iterable of the above stringsspecifying a set of linestyles to be used. If thisiterable is shorter than the number of contour levelsit will be repeated as necessary. - hatches:List[str], optional
Only applies tocontourf . A list of cross hatch patterns to use on the filled areas.If None, no hatching will be added to the contour.Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.
|
---|
Contour Plot Online
Notes
Julia Bar Plot
contourf
differs from the MATLAB version in that it does not drawthe polygon edges. To draw edges, add line contours with calls tocontour
.
contourf
fills intervals that are closed at the top; that is, forboundaries z1 and z2, the filled region is:
except for the lowest interval, which is closed on both sides (i.e.it includes the lowest value).