plotting – Formatting one-sided error bars in Mathematica 12

Below is a plot I made in MATLAB.

I need to recreate the above plot in Mathematica. This is what I’m able to achieve on Mathematica 12.2 (the slight formatting differences compared to the MATLAB plot are intentional):

As we can see, the plot in Mathematica has a non-zero “fence width” on top of each plot marker whereas the plot made in MATLAB does not. Is there any way to achieve error bars as shown in the MATLAB plot using Mathematica?

If we assume the x-coordinates are stored in `xData`, the y-coordinates in `yData`, and the tops of the error bars in `yMaxData` (all vectors of the same length), the code I use in Mathematica to generate this plot (ignoring all the formatting) is:

``````linePlotData1 = Table({xData((ii, 1)), Around(yData((ii, jj)), {0, yMaxData((ii, jj))})}, {jj, 1, numCols}, {ii, 1, numRows});
``````

where `numCols` is 2 in this case and `numRows` is 10 (the length of the data vectors).

To generate the plot, I use `ListPlot(linePlotData1)` with `ScalingFunctions` set to `{"Log", "Log"}` and various other formatting-related commands including `IntervalMarkersStyle` to format the thickness and color of the error bars. However, I wasn’t able to find any documentation regarding whether or not I can format the positive and negative directions of the error bars differently.

Is there a way to do this, preferably without having to use any external packages?

For example, can I set `IntervalMarkers` to “Bars” for the negative and “Fences” for the positive directions, respectively? The documentation doesn’t seem to have any information on whether or not doing so is possible. I tried something like `IntervalMarkers -> {{"Bars","Fences"},{"Bars","Fences"}}` (repeated twice for each of the two data “columns”), but this threw an error.

Thanks!

plotting – Computing plane waves with the mangnitue constant to 1

I have a question. In regards with the given computation,

``````u0(r_, phi_) := Sum(I^(-n) BesselJ(n, r) Exp(I n phi), {n, -5, 5});
{Plot3D(Re(u0(r, phi)), {r, 0, 4}, {phi, 0, 2 Pi},
ColorFunction -> Hue),
Plot3D(Im(u0(r, phi)), {r, 0, 4}, {phi, 0, 2 Pi},
ColorFunction -> Hue)}
{Plot3D(Abs(u0(r, phi)), {r, 0, 4}, {phi, 0, 2 Pi},
ColorFunction -> Hue, PlotRange -> All),
Plot3D(Arg(u0(r, phi)), {r, 0, 4}, {phi, 0, 2 Pi},
ColorFunction -> Hue, PlotRange -> All)}
``````

which is in Cartesian coordinates, the magnitude of the series for the plane wave must be constant 1. How do I set this in the given code?

Thanks

plotting – Connect first and last point on ListPolarPlot

I have this function that creates a plot in Wolfram Mathematica:
`ListPolarPlot[{98.00000, 93.99300, 83.60000, 67.50000, 48.72000, 30.34000, 15.75000, 5.06000, 0.96000, 0.00000, 1.23000, 6.05000, 17.25000, 33.21000, 51.62000, 70.50000, 85.36000, 95.93100, 99.50000, 94.96200, 85.36000, 69.00000, 49.30000, 30.75000, 15.50000, 5.06000, 0.93000, 0.00000, 1.20000, 5.61000, 17.75000, 32.80000, 51.04000, 69.75000, 85.36000, 94.96200, 99.00000}, Joined -> True]`

What I want to do, is to connect the first and the last point on the graph. Is there a way to do it via this function? I’ve searched for it, but didn’t find a thing to be honest.

There is a screenshot of the result that I have now:

plotting – How to calculate Fourier coefficients in the transmittance function?

Good morning, could someone help me to propose this exercise to be able to solve it

Calculate the Fourier coefficients c_s of the transmittance function t(x)= t(x+P_x) given in|x|<P_x/2,characterizing the following 1-D diffraction gratings of period P_x:
The square-wave amplitude grating composed of evenly spaced parallel slits, givingt(x) =rect(x/w), where w < P_x is the slit width.

plotting – How to plot and animate numerically calculated Poisson integral

I want to plot the expression formed from numerically calculated Poisson integrals (aka fundamental solutions of heat equation). I can only get numerical values. This question arises from my previous one.

ODE system. We extract the solutions.

``````s = NDSolve({u'(x) == -3 W(x) + x, W'(x) == u(x) - W(x)^3, u(0) == -1,
W(0) == 1}, {u, W}, {x, 0, 200})
G = First(u /. s)
g = First(W /. s)
``````

They will serve as initial conditions in Poisson integrals.
Now we choose parameter, some x and t and integration limits.

``````(Epsilon) = 1/10
T = -1/2
X = 10
p1 = -200
p2 = 200
``````

Now we consctruct the expression.

``````Q1 = 1/( 2 Sqrt(Pi *((T) + 1)*((Epsilon))^(2))) NIntegrate(
Exp(-(Abs(X - (Xi)))^2/(4*((T) +
1)*((Epsilon))^(2))) g((Xi)) G((Xi))
(-1/(2*((Epsilon))^2)), {(Xi), p1, p2})
Q2 = 1/( 2 Sqrt(Pi *((T) + 1)*((Epsilon))^(2))) NIntegrate(
Exp(-(Abs(X - (Xi)))^2/(4*((T) +
1)*((Epsilon))^(2))) g((Xi)), {(Xi), p1, p2})
q = (-2 ((Epsilon))^2 )*(Q1/Q2)
``````

I need to plot and animate `q` for any x and t intervals. By the code above I can only get numerical values.

Tried to get the tables of values and then animate it like this…

``````plots = Table(
Plot((1/( 2 Sqrt(Pi *((t) + 1)*((Epsilon))^(2))) NIntegrate(
Exp(-(Abs(x - (Xi)))^2/(4*((t) +
1)*((Epsilon))^(2))) g((Xi)) G((Xi)) (-1/(2*(
(Epsilon))^2)), {(Xi), p1, p2}))/(1/(
2 Sqrt(Pi *((t) + 1)*((Epsilon))^(2))) NIntegrate(
Exp(-(Abs(x - (Xi)))^2/(4*((t) +
1)*((Epsilon))^(2))) g((Xi)), {(Xi), p1, p2})), {x,
0, 2}, PlotRange -> {-10, 10}), {t, -2, 0, .25});
ListAnimate(plots)
``````

But Mathematica is just running and I receive the error that one number “is too small to represent as a normalized machine number”.

I think it should be very simple but I am a newbie in Wolfram Mathematica so I’m sorry if the question is too trivial. Hope to get help.

plotting – Exported Frame Tick Labels Don’t Look Anti-aliased

I have a frame with labeled gridlines and I’m exporting it as a PNG. I am using ImageResolution to scale it up. This is the output I get when there is no function being plotted (it has an alpha channel, and my picture viewer puts a black background behind it):

The text used for the font looks a little rough:

Is there any way to get it to not look so jagged around the edges of the font? Or perhaps even use Matex to make it look better?

Right now I’m using:

FrameTicks -> {b1,b2}

where

``````rx := {-2 (Pi), 2 (Pi)};
ry := rx;
a1 = Table(i*(rx((2)) - rx((1)))/8 + rx((1)), {i, 7});
a2 = Table(i*(ry((2)) - ry((1)))/8 + ry((1)), {i, 7});
b1 = {#, fractionToRow@#} & /@ a1;
b2 = {#, fractionToRow@#} & /@ a2;
``````

and I’m exporting with:

``````Export("grid.png", grd, ImageResolution -> 72*3, Background -> None);
``````

plotting – Plot a functional relation involving a derivative and inverse

I have a function `f(x)` obtained by solving certain ODE. Thus, it is given as an interpolation function. I need to plot $$frac{dx}{df}$$ as a function of $$f$$.

Below I will give a simple analytical example just to explain what I mean. Let $$f(x)=arctan(x).$$ Then we have
$$frac{df}{dx}=frac{1}{1+x^2},quad text{or} quad frac{dx}{df}=1+x^2.$$

Now we express $$x$$ in terms of $$f$$, i.e., $$x=tan(f),$$ and substitute in the equation above:
$$frac{dx}{df}=1+x^2=1+tan(f)^2.$$

Thus, given $$f(x)=arctan(x)$$, I would like to get a plot of $$1+tan(f)^2.$$

One naive way to do it is to parametrize $$f$$ and $$frac{dx}{df}$$ in terms of $$x$$ and use `ParametricPlot`

``````ParametricPlot({f(x), 1/f'(x)}, {x, -10, 10}, AspectRatio -> 1)
``````

However, for my numerically defined function this does not work very well. Additionally, I would like to get the dependence in a functional form, the best would be again an interpolation function. How can I achieve this, maybe it is possible to formulate the problem as ODE and use `NDSolve`?

plotting – Plot a Satellite Knot

I need some help to plot a Satellite or cable knot. For example, see figure A torus knot and a cable knot. (a) The red curve lying on the yellow torus is a (2,3) torus knot. (b) The embedded yellow torus has a (2,3) torus knot at its core. The red curve is a cable knot with Newton pairs (2,3) and (3,2).

(1) https://mathworld.wolfram.com/SatelliteKnot.html

(2) https://journals.aps.org/pra/abstract/10.1103/PhysRevA.95.053820

plotting – Solid Ellipsoids – Mathematica Stack Exchange

I’m using th following way to produce solid spheres for random microstructures. I’m trying to find a way to produce solid ellipsoids with the same way. Does anyone have any idea?

Centers ,X, have produced by an algorithm and they have an array structure.

``````    centers = X;
unitball[c_, x_] := EuclideanDistance[c, x] <= r;
regs = Show[
RegionPlot3D[
unitball[#, {x, y, z}], {x, 0, 1}, {y, 0, 1}, {z, 0, 1},
Mesh -> False, Boxed -> False, Axes -> False,
PlotPoints -> 100] & /@ centers]
``````

plotting – How to make a {x,y,z} plot of a data set

I’m a beginner using Mathematica so I really need help with this.

I have a data set which consist in a (X,Y) vector and a matrix of Z values. For every step of Y, I have a vector X, which is always the same, and a set of Z values (every row of the “Z” matrix is a set for each step). So, I have, for example:
{X(1…vector lenght),Y(1),Z(MatrixRow 1)} as my first set of values.
I need to put them all in the same 3D plot, but I’m not sure about how to do it.

Thank you and sorry for my english :c