# Tag Info

13

This is not really 4D data. As Geoff said, it's 3D scalar data, i.e. you're visualizing a scalar function of three variables: $f(x,y,z)$. There are several ways to visualize this kind of data, and many tools that will help you. I'll show you a few styles of plots you can make. Contour plot showing one or more $f(x,y,z) = \text{(const.)}$ surfaces, ...

10

Here I have an example: x = linspace(-5,5,100); y = linspace(-5,5,100); z = linspace(-5,5,100); [X, Y, Z] = meshgrid(x, y, z); Ex = sin(2*pi/5*Z); Ey = 0*X; Ez = 0*X; [Bx, By, Bz, V] = curl(X, Y, Z, Ex, Ey, Ez); Eplot = 0*x; Bplot = 0*x; for i=1:100 %% Integration-like procedure Eplot(i) = mean(mean(Ex(:,:,i),1),2); Bplot(i) = mean(mean(By(:,:,...

9

The traditional approach for scalar field-based data (temperature, velocity magnitude, pressure, density, etc.) plotted over two or three space dimensions uses color. It's important to note that choice of color scheme can distort your impressions of the data. For this reason, do not use a rainbow color scheme. (For why, see here, here, here, and here.) ...

9

There are a couple subtleties to your question that I think are important: You're comparing an interpreted language (Python) to a compiled language (C++). Most scientific and engineering software is developed with a heavy Linux (and UNIX) bias, and is not usually known for cross-platform compatibility or great user support (big libraries, of course, ...

6

The selection of colormap should be based on your dataset and audience, e.g., you do not want to use a colormap that have some cultural background for a group of people. Also, if your images are going to be printed (in grey scale), you should consider using a colormap that will preserve the ordering after the color transformation. Then, you should take into ...

5

Yes. Sage can plot functions adaptively; the link is to a 3d implementation, but presumably, there is an analogous 2d implementation. You could use this function that samples adaptively 1-d functions. (see https://stackoverflow.com/questions/14084634/adaptive-plotting-of-a-function-in-python for discussion) Judging from your comments, this may not be a ...

5

Your intuition is right, for example in 3D Orbitals (German Wikipedia) the caption explicitly states that 90% iso-surfaces are used. I have however seen different percentages before where the results look similar. Did you check the Mayavi Example Atomic Orbital? If you remove the phase-coloring and find the additional parameter to contour that sets the ...

5

You can use Plot Digitizer and extract the data points in your image graph as a xml file and then you can parse it by using Python. It's pretty straightforward. You need to import the image of your graph into the software. Then calibrate the X and Y axes by specifying the $x_{min}$, $x_{max}$, $y_{min}$, and $y_{max}$ which are the min and max of X and Y ...

4

{Assuming you still need the code} Let A1.wrl is your wrl file. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import re holder = [] with open("A1.wrl", "rb") as vrml: for lines in vrml: a = re.findall("[-0-9]{1,3}.[0-9]{6}", lines) if len(a) == 3: holder.append(map(float, a)) ...

4

It sounds like you want the multi-precision plot function from SymPy, which is capable of plotting arbitrary black-box functions over a given range. import math from sympy.mpmath import plot plot(lambda x: math.exp(x), [1, 4])

4

I agree that using the same color scale is generally good practice. Not doing so is confusing. Now, as you note, there are cases where this doesn't leave very much information in each picture. In such cases, you should at least make it clear in the caption that you are using different color scales for different panels of a figure.

4

Using Python and mpmath: import matplotlib import mpmath f = lambda z: z**3-z+1 mpmath.cplot(f, points=100000) Easy peasy.... See here for the documentation on mpmath.cplot

3

You can use linspace function, x=linspace(-1,3,101); func=exp(x-sqrt(2))-cos(x-sqrt(2))-(x-sqrt(2)); plot(x,func,'or');

3

You can calculate the stream function yourself, and from it you can draw contours or streamlines of constant $\psi$. Let us assume you are on a two-dimensional incompressible flow $\mathbf{u}=(u,v,0)^T$, then you can find an exact differential $d\psi$ that satisfies the mass conservation equation: $\frac{\partial u}{\partial x } + \frac{\partial v}{\... 3 My first question is, when it comes to writing the software what is the best practice for the separation of these steps? Should a program do all of these steps or is it better to divide the steps between different scripts and save the data in between? How you separate the steps depends on many things, like how long it takes to solve the ODEs, what software ... 3 A quick and dirty solution is to plot a phantom sphere outside the cube on the opposite side, and then apply clipping to the cube boundary. 3 Is the white part NaNs? If so, then you will need to use some sort of extrapolation to smooth that region. The function inpaint_nans may be appropriate (it smoothly fills in NaN regions, essentially by solving a Laplace equation). If more smoothing is needed, you could then follow Juan's approach (i.e. gaussian blur). Another thing you might consider: I do ... 3 Points for a scatterplot of a probability density function can simply be sampled from it. I used the Psi(X1, X2) you defined in your linked post. The number of sample points, alpha and the marker type can be tuned. The axis can be renormalized to the dimensions of th meshgrid. In the code below I take the absolute value of the input matrix because it had ... 3 As sensitive_scientist mentioned, Measuring Parallel Scaling Performance provides the information you want on how to calculate strong\weak scaling. I've plotted your data in a way I consider it the most informative: both execution timing and strong scaling. Note: In my opinion, it is preferred to plot the execution timing on a log-log plot. The dashed line ... 3 First, you originally wrote that your equation is$\cos(K)=5 \text{ sinc}(5.12\sqrt{E})- \cos(5.12\sqrt{E})$, but you clearly meant$\cos(K)=5 \text{ sinc}(5.12\sqrt{E}) + \cos(5.12\sqrt{E})$Second, the$\text{sinc}()$function has differing conventions. The other question is based on Mathematica, which uses the convention$\text{sinc}(x) \equiv \frac{\sin ...

3

As you may know: $$\int x^y \, dx = \dfrac{x^{y+1}}{y+1},$$ with $y \neq 1.$ If you want to plot the function $\dfrac{x^{y+1}}{y+1}$ for a specific $y$ using Matplotlib, here is the answer: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D x = np.linspace(-4, 4, 30) y = np.linspace(-4, 4, 30) def func(x, y, ...

3

You might be interested in trying other visualization tools such as ParaView, Mayavi or PyVista. But, since the question is about Matplotlib, I would suggest that you use tricontour, tricontourf or tripcolor. They already accept the data in your format. Keep in mind that the enumeration of nodes starts from 0 in Python. The following snippet show your data ...

3

I received a solution to this question from MATLAB's community. Essentially, I need to specify which contour lines to plot using the 'levels' spot on the 'contour()' command. Levels allows you to not only choose how many but which lines to plot. If you define a vector such as vlevel = linspace(20, 65, 10); and then place it in the 'levels' spot of ...

3

You don't need symbolic variables to compute the approximated potential for your Riemann sums. You can just use meshgrid to evaluate the potential in each point of interest. For the electric field, you can just compute the derivative analytically and then repeat the process for each component or compute a numerical gradient with gradient. There are better ...

2

Well, for one, you can call gnuplot as a library. Pretty much every command you'd use at the prompt has a similarly-named API function.

2

Well I've figured out a way to do it. It's a bit convoluted but I figured I'd share it here anyway. I'm positive there is a faster way to do this but since I only need to really do this a couple of times per simulation, it's not a huge deal. % the line y = 0 xy = [linspace(0,1,100)', zeros(100,1)]; zz = zeros(100,1); for i=1:100 for j=1:nElements ...

2

C++ does not have a standard library that contains the ability to generate plots (or, in fact, anything graphical). Nor does C++ have a system of packages with a package manager that allows you to import this functionality. However, there are cross-platform libraries that facilitate what you want. The most widely used one, also available on Windows, is ...

2

From browsing some forum posts, it appears that the numerical solution to these equations is not trivial to obtain. See, for example, this discussion (admittedly dated now). You indicate in your post that you are relatively new to numerical PDE solvers, and so the following references may be more involved than you were hoping for. In particular, they require ...

2

Should a program do all of these steps or is it better to divide the steps between different scripts and save the data in between? Keep them separate. The reason to consider integrating a simulation (solving ODEs) and analysis is to avoid writing data to disk and then reloading it for the analyses. If your ODE is hard to solve (more than O(N)) and you ...

Only top voted, non community-wiki answers of a minimum length are eligible