contourf

matplotlib tricontourf ploblem when I give more data point

我怕爱的太早我们不能终老 提交于 2019-12-20 02:51:06
问题 I have got a problem when i try to plot the stress. import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as mtri import matplotlib.cm as cm def plot(x_plot, y_plot, a_plot): x = np.array(x_plot) y = np.array(y_plot) a = np.array(a_plot) triang = mtri.Triangulation(x, y) refiner = mtri.UniformTriRefiner(triang) tri_refi, z_test_refi = refiner.refine_field(a, subdiv=4) plt.figure(figsize=(18, 9)) plt.gca().set_aspect('equal') # levels = np.arange(23.4, 23.7, 0.025) levels =

How do I create a colormap from an existing data set in Matlab?

痴心易碎 提交于 2019-12-14 03:25:40
问题 I currently have a 2-D contour plot in Matlab from an existing data set. I made an [x,y] mesh grid and used this mesh grid and z-data to produce a 2-d contour plot using contourf(x, y, z). My goal is to reproduce this same data as a colormap, with smooth color gradients, rather than as a 2-d contour plot, with distinct color bands. I have tried using imagesc(x, y, z) with [x,y] as a mesh grid and without. I ended up with an error function "Attempt to execute SCRIPT imagesc as a function:" x =

Matlab\Octave haven't the same result with contourf

a 夏天 提交于 2019-12-13 23:46:54
问题 I have a problem to use contourf in octave. If I test the following code in octave and matlab, the result is not at all the same. The result with Matlab is good. A1=[38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100 38 44 51 58 65 72 79 86 93 100] B1=[ 1 1 1 1 1 1 1 1

Colormap three colors

99封情书 提交于 2019-12-13 13:49:07
问题 I have a netcdf file with positive and negative currents (upwelling and downwelling respectively). I want to create a contourf where downwelling is green, upwelling is red and 0 is black. So far this is my code including some code from the Mathworks website https://nl.mathworks.com/matlabcentral/answers/81352-colormap-with-both-positive-and-negative-values : %open netcdf file ncdisp('20110810_061103.nc'); ncdisp('grid.nc'); latu=ncread('grid.nc','latitude_u'); lonu=ncread('grid.nc','longitude

How can I plot a single 2-D curve onto a colormap in Matlab?

匆匆过客 提交于 2019-12-12 06:45:43
问题 I have created a smooth color gradient 2-D contour plot with existing compiled data in Matlab. I have an x-axis, y-axis, and z-data contour plotted as a colormap. My goal is to plot a 2-D curve onto the colormap, representing a single z-data value, but I don't know how. Does anyone know how to plot a 2-D curve onto a 3-D colormap? I have provided a link to the current colormap onto which I wish to plot a single z-value as a curve. Existing colormap x = 0.05:0.05:1; y = 0.0:0.05:1; [X, Y] =

Create a colormap in matlab [duplicate]

狂风中的少年 提交于 2019-12-12 01:47:53
问题 This question already has answers here : How to create a custom colormap programmatically? (2 answers) Closed 4 years ago . I have a contour plot with data that goes from -90 to 90 degrees. for now i am using jet so I have a map that looks like this I have been asked to change the colormap so that instead of having a gradient, I have a fixed color for each 5 degress (so I believe 36 colors). Also i was thinking of maybe having same colors for the interval [5 10] and [-10 -5], and so on if

contourf() plots white space over finite data

烈酒焚心 提交于 2019-12-11 09:17:41
问题 I'm attempting to plot a 3D chart using matplotlib.pyplot.contourf() with the following program: import numpy as np import matplotlib.pyplot as plt import scipy # calculates Fast Fourier transforms for each value in the 1D array "Altitude" # and stacks them vertically to form a 2D array of fft values called "Fourier" Fourier = np.array([]) for i in range(len(Altitude)): Ne_fft = Ne_lowpass[i,:]/np.average(Ne_lowpass[i,:]) Ne_fft = Ne_fft - Ne_fft.mean() W = scipy.fftpack.fftfreq(10*Ne_fft

Symmetrical Log color scale in matplotlib contourf plot

妖精的绣舞 提交于 2019-12-11 07:41:55
问题 How do I create a contour plot with a symlog (symmetrical log) scale for the contours. i.e. a log scale that shows both negative and positive values. One possibility would be to work off of this example: http://matplotlib.org/examples/pylab_examples/contourf_log.html Which gives this recipe for a log scale: from matplotlib import pyplot, ticker cs = pyplot.contourf(X, Y, z, locator=ticker.LogLocator()) However, this doesn't allow for negative values. There is a ticker.SymmetricalLogLocator()

Contouring a mesh and assigning magnitude arrows in Matlab

房东的猫 提交于 2019-12-08 07:46:57
问题 I want to assign vector to a contourf graph, in order to show the direction and magnitude of wind. For this I am using contourf(A) and quiver(x,y) , where as A is a matrix 151x401 and x,y are matrices with the same sizes (151x401) with magnitude and direction respectively. When I am using large maps i get the position of the arrows but they are to densily placed and that makes the graph look bad. The final graph has the arrows as desired, but they are to many of them and too close, I would

Contouring a mesh and assigning magnitude arrows in Matlab

房东的猫 提交于 2019-12-07 16:23:27
I want to assign vector to a contourf graph, in order to show the direction and magnitude of wind. For this I am using contourf(A) and quiver(x,y) , where as A is a matrix 151x401 and x,y are matrices with the same sizes (151x401) with magnitude and direction respectively. When I am using large maps i get the position of the arrows but they are to densily placed and that makes the graph look bad. The final graph has the arrows as desired, but they are to many of them and too close, I would like them to be more scarce and distributed with more gap between them, so as to be able to increase