How do one plot the absolute value of the $|\Gamma(z)|$ with Maple?
As in the WIKI figure:
http://de.wikipedia.org/wiki/Gammafunktion#mediaviewer/File:Gamma_abs_3D.png
plot3d(
abs(GAMMA(x+I*y)), x= -4.6..5.1, y= -5.1..5.1,
view= [DEFAULT$2, 0..6],
labels= [Re(z), Im(z), ``], title = abs(GAMMA(z))
);
The command plots:-complexplot3d is intended as a convenient way of obtaining such plots (using z instead of the plot3d command with x+I*y, and putting in the labels automatically).
P := plots:-complexplot3d( abs(GAMMA(z)), z=-4-4*I..4+4*I,
view=[-4..4,-4..4,0..6], orientation=[-120,75] ):
For some reason, the surface stored in structure P gets some blue color that overrides the shading scheme.
P;
If we remove that COLOR substructure then the underlying shading scheme (which we could change in the original call, using the shading option) is revealed.
subsindets(P,specfunc(anything,COLOR),u->NULL);
I will submit a bug report about that heavy-handed blue coloring.
Related
I am currently using the Plots package and have it along with the PyPlot packages installed. With the code
using Plots
y = rand(10, 10)
pyplot()
plt = plot(y, st=:heatmap, clim=(0,1), color=:coolwarm, colorbar_title="y")
I am able to produce this
heat map
My question is how I can change the color gradient from its current setting (coolwarm which corresponds with a transition from red to gray to blue) to a new setting which has a gradient from red to green to blue. Is there some way to create a custom colorgradient and use that as an argument where I have 'coolwarm' in my sample code?
Yes. First of all there are numerous color libraries in Plots. Try clibraries(), then e.g. cgradients(:colorbrewer) or showlibrary(colorbrewer). In addition, you can make your own gradient with e.g. cgrad([:red, :green, :blue]) and pass that as the color argument.
I am using GNU plot (gnuplot) to plot some output data from integration of a strange attractor (see Wikipedia) - and as this is a strange attractor the line "rolls around itself in 3D space".
This makes it difficult to see what happens when plotting a lot of data. See this image:
Is there any way to plot a transitioning or fading color from say red at the start to blue at the end? I know gnuplot is a powerful tool but perhaps I ask too much?
I found an answer here: gnuplot
# start value for H
h1 = 117/360.0
# end value for H
h2 = 227/360.0
# creating the palette by specifying H,S,V
set palette model HSV functions (1-gray)*(h2-h1)+h1,1,0.68
splot "output.csv" every 100 using 2:3:4:1 with lines linecolor palette title "Lorenz System"
The 4th argument after using is the color variable to use. In my case this is the time variable. (Col 1)
I make a plot like this:
plot(
layer(x=sort(randn(1000),1), y=sort(randn(1000),1), Geom.point),
layer(x=[-4,4], y=[-4,4], Geom.line(), Theme(default_color=color("black"))))
As you can see, the white circle around the points makes the high density parts of the plot almost white.
I would like to change the outer circle color of the points to black (or blue) to better show that the points are really there.
From the Gadfly documentation it seems like the highlight_color argument of Theme() might do that, but it takes a function as argument.
I don't understand how that is supposed to work. Any ideas?
The argument name turns out to be discrete_highlight_color...
It should be a function that modifies the colour used for the plot,
typically by making it lighter (a "tint") or darker (a "shade").
In our case, we can just ignore the current colour and return black.
using Color
using Gadfly
plot(
layer(
x = sort(randn(1000),1),
y = sort(randn(1000),1),
Geom.point,
# Theme(highlight_width=0.0mm) # To remove the border
Theme( discrete_highlight_color = u -> LCHab(0,0,0) )
),
layer(
x = [-4,4],
y = [-4,4],
Geom.line(),
Theme(default_color=color("black"))
)
)
To find the correct argument, I first typed
code_lowered( Theme, () )
which gives the list of arguments,
and then
less( Gadfly.default_discrete_highlight_color )
which shows how the default value is defined.
For those like me trying to solve this problem more recently, I discovered that the best way to get rid of that pesky white ring is through the theme setting highlight_width=0pt
for example
plot(x=rand(10),y=rand(10),Theme(highlight_width=0pt))
I had some additional themes in the below image
Is it possible to have different colours in my plot in Scilab? I use the mtlb_hold to hold the graph and it works fine, but my problem is that then I have the same colours in my graph. In Matlab with the hold command, I have different colours. Is it possible to have different colours in Scilab too?
Thank you in advance.
Just found it. In the plot function, for example plot(), you can pass a second argument which specifies the color that will be used. For example, you can use use b for blue color, g for green, r for red and call plot() like this: plot(z,"r").
The SciLab documentation provides examples for using colors:
https://help.scilab.org/doc/5.3.3/en_US/color.html
The plot2d()-function e.g. accepts an attribute style, where you can even specify a color for each function with its full name:
plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);
I'm trying to plot a box within a filled.contour plot, but unfortunately, when I plot the lines() after the filled.contour plot is created, the figure is shifted to the right because the scale forces the image to the left, but the box stays at the same coordinates. Here's what my code looks like:
dev.new(width=6,height=7)
mypredict<-matrix(data=mypredict,nrow=20,ncol=25)
filled.contour(x=seq(from=-1.5,to=1.5,length=20),
y=seq(from=1,to=3.75,length=25),
z=mypredict,
col=hsv(h=seq(from=2/3,to=0,length=20),s=1,v=1)
)
top <- 3.42
bot <- 1.56
lines(c(-1,-1),c(bot,top))
lines(c(1,1),c(bot,top))
lines(c(-1,1),c(top,top))
lines(c(-1,1),c(bot,bot))
Does anyone know how I can plot those lines within the filled.contour function? Otherwise, the lines do not plot correctly onto the main image, since the scale/legend of the graph is placed on the right.
Thanks!
The manual page for filled.contour explains the problem (and gives a solution)
This function currently uses the ‘layout’ function and so is restricted
to a full page display. As an alternative consider the ‘levelplot’
and ‘contourplot’ functions from the ‘lattice’ package which work in
multipanel displays.
The output produced by ‘filled.contour’ is actually a combination
of two plots; one is the filled contour and one is the legend.
Two separate coordinate systems are set up for these two plots,
but they are only used internally - once the function has returned
these coordinate systems are lost. If you want to annotate the
main contour plot, for example to add points, you can specify
graphics commands in the ‘plot.axes’ argument. An example is
given below.
So essentially you pass some instructions as the plot.axes parameters to override standard behaviour.
In your example:
filled.contour(x = seq(from=-1.5,to=1.5,length=20),
y = seq(from=1,to=3.75,length=25), z = mypredict,
col = hsv(h=seq(from=2/3,to=0,length=20),s=1,v=1),
plot.axes = {axis(1); axis(2); rect(left, bottom, right, top);})
Note that you have to recreate the two axes otherwise they will not be drawn. Also, no need to use the lines statement, when there is a rect function! :)
Hope this helps