plotting – How to recreate this complex iteration

I came across this image in a book Im reading:

enter image description here

(taken from Rational Iteration Complex Analytic Dynamical Systems from Steinmetz. I hope it is okay to share it here)

and I try to recreate it in Mathematica. I tried

JuliaSetPlot((9 + 2 z + 9 z^2)/20, z)

which gives a complete different picture.

enter image description here

I also tried to use

ColorFunction -> With({cf = ColorData("M10DefaultFractalGradient")}, cf@Sqrt(#3) &)

which doesn’t improve anything. So JuliaSetPlot might not be the right method. Do you have any suggestions?

plotting – Why PieChart Callout is so slow?

I was testing PieChart using the following random data before touching my own dataset and found the ChartLabels using the Callout function is so slow. I wonder why and is there anyway to improve its performance? I tried PerformanceGoal→"Speed" (learned from here) as the PieChart option, it seems to me not very effective. On my laptop, the following three ChartLabels option yield 0.204785, 15.0763, 48.0431 with AbsoluteTiming.

Generate data

SeedRandom(14);
list = RandomInteger({1, 100}, 300);
stats = Counts@list

Plot PieChart

PieChart(stats,ChartStyle->"Pastel",

ChartLabels->Placed(Keys@stats,"RadialCallout"),(*okay*)
ChartLabels->Callout(Keys@stats,Automatic),(*slow*)
ChartLabels->Callout(Row({Style(#((1)),Italic)," = ",Style(#((2)))})&/@rules,Automatic),(*too slow*)

ImageSize->Full)//AbsoluteTiming

rules used in the 3rd one.

rules=Normal@stats;

BTW, when I changed the Head to BarChart with the rest the same, it is faster. However, the Callout slow issue remained.

plotting – highlighting certain points on List Line Plot

I have a list made out of points {x,y(x)} which I’m plotting using ListLinePlot.
I would like to highlight two point and plot a big dot (marker) on them with different color, lets take two point, for example, x=4 highlighted with the color yellow, and x=20 with the color red.
The model:

n = 100;
f(x_) = x^0.5 + 4;
ListLinePlot(Table({x, f(x)}, {x, 1, n}))

Any help?

plotting – How to plot a single column of data exported from a CSV file?

I am importing data from a CSV file using this code:

k = Import(“D:/MTU/Mathematica/data.csv”);

Once I have this data, I want to plot it as a scatterplot (I guess I use LinePlot for that). But I need the values from the data to be on the y-axis with the x-axis starting from 1 and increasing in increments of 1. How can I do this?

Thanks!

This is what the data looks like:

Data from CSV file

plotting – I have plotted 4 different plots (each are different variables) but used the same 3 methods to solve in each

I have 4 different plots and each for displacement, angle theta, velocity and angular velocity. I used 3 different methods to solve and I don’t know how to produce those 3 methods in one plot. For example, my first plot is

p1=ListPLot[Table[{n-1_h,X[n][[1]]}, {n,N1}], Joined->True]

This produced the plot I needed, however I need to add the three different methods in that plot to compare.

The 3 different methods I used to solve are defined as EulerMethod, RungeKutta2, and RungeKutta4.

I need to show these 3 methods in p1, with each method a different color. Please help!

plotting – Extracting intensity from density plot image given color bar

I have an image showing a density plot from a paper, as well as the corresponding color bar. I am trying to convert this back to a 2D array of intensities.

enter image description here

2

Here’s what I did, which works but seems to be imperfect.

imagedata = ImageData(plotimage)
colordata = ImageData(colorimage)((row))

where row is a number which selects a single row out of the center of the color bar. imagedata is a rank 2 array of {R,G,B} values, while colordata is a rank 1 array of {R,G,B} values (between 0 and 1). I assume the color bar goes from 2 to 7. I then sample a number of colors from the bar with equal spacings,

colorbar = colordata((1;;-1;;step))
for some integer step such as step = Round(Length@colordata/30.). Let ncols = Length@colorbar, the number of color samples. This looks like

RGBColor@@#&/@colorbar
enter image description here

Since the image has a lot of white space which I want to differentiate, I add a single white element as the first element: colorbar = Prepend(colorbar,{1,1,1}).

Now my basic strategy is to get each pixel’s {R,G,B} (I downsample the image to make this process not take forever because it’s rather inefficient) and associate it to a single element of colorbar. I don’t know the best way to do this, but my strategy right now is to minimize Norm({R,G,B}-{R',G',B'}), to find the {R',G',B'} in colorbar which is “closest” by this metric to the color of the pixel, I don’t know if this is a good method of color matching though. I define a function

f(c_) := Module({n},
  n = First@First@Position(colordata,#)&@First@MinimalBy(colordata,Norm(c-#)&)-1;
  If(n==0,
     0,
     2. + 5 n/ncols
  )
  RGBColor @@ colordata((n))
)

which takes an {R,G,B} vector, uses MinimalBy to find the element of colorbar for which the Norm of the difference is minimal, and returns its index minus one. Since white was the first index, if the result it zero I return 0 while for non-white colors I scale the output between 2 and 5 like the original color scale.

Defining a color function from the sampled colors,

colorf(x_) := Blend(cols,(x-2)/5)

the plotted result looks like this:

imagedataConverted = ParallelTable(
   f(imagedata((j, i))),
   {j, 1, Dimensions(imagedata)((1)), 1},
   {i, 1, Dimensions(imagedata)((2)), 1}
);

ListDensityPlot(imagedataConverted,
 ColorFunction -> colorf,
 ColorFunctionScaling -> False,
 InterpolationOrder -> 0,
 PlotLegends -> Placed(BarLegend({colorf, {2, 7}}), Above),
 PlotRange -> {2, 7},
 ImageSize -> Small)

enter image description here

This seems to work, but there are some subtle differences in the output. Overall it seems to me that the output is on average a bit lighter, and especially so near the edges. This is causing me some issues because I want the match to be as close as possible, and I cannot find a way to improve the accuracy of this method. Is there a simpler/more accurate way to do this? Bonus for efficiency.

plotting – How to plot two time intervals of a graph simultaneously?

The graphs of my provided code look approximately like the one in the picture below. How is it possible to plot such graphs? Please help how to break the axis scale as shown. Any suggestion appreciated. Thanks a lot.
enter image description here

Subscript(C, i)=2.5*10^6
Subscript(k, e)=315
σ=1*10^-9
Subscript(S, e)=1.58*10^-5
g=2.3*10^16
Subscript(C, e)=2.1*10^4
τ=1*10^-15
a=1/τ
Subscript(w, 1)=1
Subscript(s, 1)=y/(Subscript(w, 1)*σ)
Subscript(b, 1)=g/Subscript(C, e)*(1+(Subscript(k, e)*Subscript(s, 1)^2)/g)
Subscript(Δ, 1)=Sqrt(Subscript(b, 1)^2-4*Subscript(k, e)*Subscript(s, 1)^2*g/(Subscript(C, i)*Subscript(C, e)))
Subscript(p, 11)=(-Subscript(b, 1)+Subscript(Δ, 1))/2
Subscript(p, 12)=(-Subscript(b, 1)-Subscript(Δ, 1))/2
Subscript(T, i)=(Subscript(S, e)*g)/(2*π*τ*Subscript(C, i)*Subscript(C, e))*NIntegrate(BesselJ(0,y)*Exp(-((σ^2*Subscript(s, 1)^2)/4))*(Exp(-a*t)/((a+Subscript(p, 11))*(a+Subscript(p, 12)))+1/(Subscript(p, 11)-Subscript(p, 12))*(Exp(Subscript(p, 11)*t)/(Subscript(p, 11)+a)-Exp(Subscript(p, 12)*t)/(Subscript(p, 12)+a)))*y/(σ*Subscript(w, 1))^2,{y,0,100})
Subscript(T, e)=Subscript(T, i)+Subscript(S, e)/(2*π*τ*Subscript(C, e))*NIntegrate(BesselJ(0,y)*Exp(-((σ^2*Subscript(s, 1)^2)/4))*(-((a*Exp(-a*t))/((a+Subscript(p, 11))*(a+Subscript(p, 12))))+1/(Subscript(p, 11)-Subscript(p, 12))*((Subscript(p, 11)*Exp(Subscript(p, 11)*t))/(Subscript(p, 11)+a)-(Subscript(p, 12)*Exp(Subscript(p, 12)*t))/(Subscript(p, 12)+a)))*y/(σ*Subscript(w, 1))^2,{y,0,100})
Plot(Subscript(T, e),{t,0,1*10^-14})
Plot(Subscript(T, i),{t,0,1*10^-14})

plotting – How to plot two time intervals of a graph simultaneoulsy?

the graphs of my provided code look approximately like the picture below. How can I plot such gpaph, help me please. Any suggestion appreciated. Thanks a lot.
enter image description here

Subscript(C, i)=2.5*10^6
Subscript(k, e)=315
σ=1*10^-9
Subscript(S, e)=1.58*10^-5
g=2.3*10^16
Subscript(C, e)=2.1*10^4
τ=1*10^-15
a=1/τ
Subscript(w, 1)=1
Subscript(s, 1)=y/(Subscript(w, 1)*σ)
Subscript(b, 1)=g/Subscript(C, e)*(1+(Subscript(k, e)*Subscript(s, 1)^2)/g)
Subscript(Δ, 1)=Sqrt(Subscript(b, 1)^2-4*Subscript(k, e)*Subscript(s, 1)^2*g/(Subscript(C, i)*Subscript(C, e)))
Subscript(p, 11)=(-Subscript(b, 1)+Subscript(Δ, 1))/2
Subscript(p, 12)=(-Subscript(b, 1)-Subscript(Δ, 1))/2
Subscript(T, i)=(Subscript(S, e)*g)/(2*π*τ*Subscript(C, i)*Subscript(C, e))*NIntegrate(BesselJ(0,y)*Exp(-((σ^2*Subscript(s, 1)^2)/4))*(Exp(-a*t)/((a+Subscript(p, 11))*(a+Subscript(p, 12)))+1/(Subscript(p, 11)-Subscript(p, 12))*(Exp(Subscript(p, 11)*t)/(Subscript(p, 11)+a)-Exp(Subscript(p, 12)*t)/(Subscript(p, 12)+a)))*y/(σ*Subscript(w, 1))^2,{y,0,100})
Subscript(T, e)=Subscript(T, i)+Subscript(S, e)/(2*π*τ*Subscript(C, e))*NIntegrate(BesselJ(0,y)*Exp(-((σ^2*Subscript(s, 1)^2)/4))*(-((a*Exp(-a*t))/((a+Subscript(p, 11))*(a+Subscript(p, 12))))+1/(Subscript(p, 11)-Subscript(p, 12))*((Subscript(p, 11)*Exp(Subscript(p, 11)*t))/(Subscript(p, 11)+a)-(Subscript(p, 12)*Exp(Subscript(p, 12)*t))/(Subscript(p, 12)+a)))*y/(σ*Subscript(w, 1))^2,{y,0,100})
Plot(Subscript(T, e),{t,0,1*10^-14})
Plot(Subscript(T, i),{t,0,1*10^-14})

plotting – Create a revolved 3D image of a line

p = {{0, 0}, {3, 2}, {6, 10}, {9, 8}, {12, 7}, {15, 9}, {18, 9}};
Graphics[Line[p]]

These are the x,y coordinates I got to work with in order to make a line and then make the whole thing rotate to form a 3D image.

I’ve tried to use RevolutionPlot3D but I only get a cone. None of the points gets used.

How do i do to get an image like this and calculate the volume of the body?
Example image

complex – My plotting comes out to be gray not coloured using AbsArgPlot function in Mathematica. What is the reason for not getting a coloured graph??h

My graph comes out to be gray, not coloured using AbsArgPlot function in Mathematica. What is the reason for not getting a coloured graph or what I can deduce from it about the complex function that I considered.
Basically I am using a complex Lagrange interpolating polynomial.
I am including the graph.
The Exp[z] gives a good coloured graph given below.

z = Cos[j] + I*Sin[j];

AbsArgPlot[{Exp[z]}, {j, 0, 2 Pi}, Filling -> Axis]

enter image description here

The interpolating polynomial that I created using the nodes on the unit circle produces the below graph which comes out to be gray.

z = Cos[j] + I*Sin[j];

AbsArgPlot[{LR}, {j, 0, 2 Pi}, Filling -> Axis]

,

where LR is the interpolatory polynomial I created.
enter image description here
My interpolating polynomial approximates Exp[z] nicely as the graph turns out to be similar. but what can I deduce with this gray colour coming .