![]() ![]() For example, plotattr("cbar") shows that it can take either symbols from a predefined list (e.g. To get a full list of the available values that an attribute can take, type plotattr("attribute") into the REPL. If only black lines are desired, you can set the color attribute like so: contour(x, y, z, color=)Īnd for alternating black and red lines of a specific hex value, you could type color=, and so on. using LaTeXStringsĬontour(x, y, z, levels=10, color=:turbo, clabels=true, cbar=false, lw=1) Note that levels, color, and contour_labels need to be specified in contour. The widths of the isocontours can be changed using linewidth, or lw.The colorbar location can be changed with the attribute colorbar, alias cbar.A full list of colormaps can be found in the ColorSchemes section of the manual. The default colormap is :inferno, from matplotlib. The colormap can be changed using seriescolor, which has the alias color, or even c.(To install this package, type ] and then add LaTeXStrings into the REPL.) We'll use the LaTeXStrings.jl package to write the function expression in the title. Besides the title and axes labels, we can also add contour labels via the attribute contour_labels, which has the alias clabels.The number of levels can be changed with levels.Let's make this plot more presentable with the following attributes: Beware that this will NOT work for other backends such as the default GR backend, which require x and y to both be column vectors. With the pythonplot backend, contour can also take in a row vector for x, so alternatively, you can define x as a row vector as shown below and PythonPlot will know how to plot it correctly. Much like with plot! and scatter!, the contour function also has a mutating version contour! which can be used to modify the plot after it has been generated. is shorthand for broadcasting since x' is of size (1, 100) and y is of size (50, ), z = f(x', y) will broadcast the function f over x' and y and yield a matrix of size (50, 100). In the tutorial, we mentioned that the macro evaluates whatever is to the right of it in an element-wise manner. You can check the shape of x' by typing size(x'). This is the adjoint operator and makes x a row vector. ![]() Let's define some ranges and a function f(x, y) to plot. All of the plots generated on this page use PythonPlot, although the code will work for the default GR backend as well. The first time you call pythonplot(), Julia may install matplotlib for you. PythonPlot requires the PythonPlot.jl package which can be installed by typing ] and then add PythonPlot into the REPL. Practice it now so that when you actually need to make a plot you will be prepared.The easiest way to get started with contour plots is to use the PythonPlot backend. ![]() Plot the fake gravitational potential of a Lagrange point. Plot the gravitational potential of the Earth-moon system. Make some type of three dimensional plot. It's better have sloppy code that you made yourself than some pre-built code that you have no idea how it works. However, I like to remind everyone that I am just a human.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |