16

We are currently writing a paper that contains a number of comparable plots, and we more or less had the same problem. The paper is about comparing the scaling of different algorithms over the number of cores, which ranges between 1 and up to 100k on a BlueGene. The reason for using loglog-plots in this situation is the number of orders of magnitude involved....


14

Georg Hager wrote about this in Fooling the Masses - Stunt 3: The log scale is your friend. While it is true that log-log plots of strong scaling are not very discerning on the high end, they allow for showing scaling across many more orders of magnitude. To see why this is useful, consider a 3D problem with regular refinement. On a linear scale, you can ...


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(:,:,...


10

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, ...


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.) ...


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

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

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 ...


5

Sounds like you want to omit the use of a MATLAB toolkit/Octave package. Of course you can build the bode diagram from scratch: % transfert function as anonymous function h = @(s)(1)./(2*s.^2+3*s+4); % frequency vector w = 2*pi*logspace(-2,2,1000); % magnitude & phase estimation mag = abs(h(1j*w)); magDB = 20*log10(mag); phaseDeg = rad2deg(angle(h(1j*w))...


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

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

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

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

{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)) ...


3

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 ...


3

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.


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

I agree with everything Jed had to say in his response, but I wanted add the following. I've become a fan of the way Martin Berzins and his colleagues show scaling for their Uintah framework. They plot weak and strong scaling of the code on log-log axes (using the run time per step of the method). I think it shows how the code scales pretty well (though ...


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.


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