mplot3d

Change 3D background to black in matplotlib

萝らか妹 提交于 2021-02-08 08:22:21
问题 I'm having trouble changing the background of my 3d graph to black. This is my current code. When I do set facecolor to black, it changes the inside of the graph to be grey, which is not what I want. fig = plt.figure() fig.set_size_inches(10,10) ax = plt.axes(projection='3d') ax.grid(False) ax.xaxis.pane.set_edgecolor('b') ax.yaxis.pane.set_edgecolor('b') ax.zaxis.pane.set_edgecolor('b') # plt.gca().patch.set_facecolor('white') # plt.axis('On') fig.patch.set_facecolor('black') ax.scatter(xs =

3D plot with Matplotlib

て烟熏妆下的殇ゞ 提交于 2021-02-05 20:10:48
问题 I'm simply trying to plot a surface and its contour in 3D, exactly as in this example. This is the code I'm using to do it: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm import numpy def plot_3d_contour(x_dim, y_dim, x_steps, y_steps, scalar_field, file_path): fig = plt.figure() x, y = numpy.mgrid[-x_dim/2:x_dim/2:x_steps*1j, -y_dim/2:y_dim/2:y_steps*1j] v_min = numpy.min(scalar_field) v_max = nupmy.max(scalar_field) ax = fig.gca(projection=

3D plot with Matplotlib

偶尔善良 提交于 2021-02-05 20:01:30
问题 I'm simply trying to plot a surface and its contour in 3D, exactly as in this example. This is the code I'm using to do it: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm import numpy def plot_3d_contour(x_dim, y_dim, x_steps, y_steps, scalar_field, file_path): fig = plt.figure() x, y = numpy.mgrid[-x_dim/2:x_dim/2:x_steps*1j, -y_dim/2:y_dim/2:y_steps*1j] v_min = numpy.min(scalar_field) v_max = nupmy.max(scalar_field) ax = fig.gca(projection=

3D plot with Matplotlib

霸气de小男生 提交于 2021-02-05 19:59:11
问题 I'm simply trying to plot a surface and its contour in 3D, exactly as in this example. This is the code I'm using to do it: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm import numpy def plot_3d_contour(x_dim, y_dim, x_steps, y_steps, scalar_field, file_path): fig = plt.figure() x, y = numpy.mgrid[-x_dim/2:x_dim/2:x_steps*1j, -y_dim/2:y_dim/2:y_steps*1j] v_min = numpy.min(scalar_field) v_max = nupmy.max(scalar_field) ax = fig.gca(projection=

Graph with multiple x and y axis using Matplotlib

女生的网名这么多〃 提交于 2021-01-27 23:12:11
问题 As I checked with the Matplotlib document and other resources. I got that when multiple axis were created they are not depend on each other and we can plot the multiple line as per different axis. But I need to plot the graph like two Y-axis contains with the temperature as (Celsius and Fahrenheit) and need to plot only one single line related to that so with 1st axis user able to check Celsius and with 2nd axis Fahrenheit. with x-axis as range (1 -24 hr). Suggestions are most welcome. 回答1:

Can't set axis scale to logarithmic in 3D plot in matplotlib

喜你入骨 提交于 2021-01-27 20:01:13
问题 I would like to 3D plot the surface of a data 2d array with dimension [50,250]. Two of the axes ( x, z ) should be in logarithmic scale. Here's a MWE: import numpy as np xx = np.asanyarray([np.ones([250])*(m+1) for m in range(50)]) yy = np.asanyarray([range(250) for m in range(50)]) zz = np.asanyarray([np.sqrt(np.arange(250)*m) for m in range(50)]) import matplotlib.pyplot as plt from matplotlib import cm fig = plt.figure() ax = fig.gca(projection='3d') surf = ax.plot_surface(xx, yy, zz, cmap

How to plot a 3D histogram with matplotlib/mplot3d?

微笑、不失礼 提交于 2021-01-27 07:23:39
问题 I have three arrays and I am trying to make a 3D histogram. x = [1, 2, 3, 2, 5, 2, 6, 8, 6, 7] y = [10, 10, 20, 50, 20, 20, 30, 10, 40, 50, 60] z = [105, 25, 26, 74, 39, 85, 74, 153, 52, 98] Here's my attempt so far: from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.axes(projection='3d') binsOne = sorted(set(x)) binsTwo = sorted(set(y)) hist, xedges, yedges = np.histogram2d(x, y, bins=[binsOne, binsTwo]) xpos, ypos = np

matplotlib plotting multiple lines in 3D

試著忘記壹切 提交于 2021-01-27 07:10:19
问题 I am trying to plot multiple lines in a 3D plot using matplotlib. I have 6 datasets with x and y values. What I've tried so far was, to give each point in the data sets a z-value. So all points in data set 1 have z=1 all points of data set 2 have z=2 and so on. Then I exported them into three files. "X.txt" containing all x-values, "Y.txt" containing all y-values, same for "Z.txt". Here's the code so far: #!/usr/bin/python from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as

matplotlib plotting multiple lines in 3D

你。 提交于 2021-01-27 07:07:32
问题 I am trying to plot multiple lines in a 3D plot using matplotlib. I have 6 datasets with x and y values. What I've tried so far was, to give each point in the data sets a z-value. So all points in data set 1 have z=1 all points of data set 2 have z=2 and so on. Then I exported them into three files. "X.txt" containing all x-values, "Y.txt" containing all y-values, same for "Z.txt". Here's the code so far: #!/usr/bin/python from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as

mayavi 3d object in matplotlib Axes3D

孤者浪人 提交于 2021-01-22 13:22:11
问题 I sometimes find myself frustrated with the lack of certain rendering features in matplotlib's mplot3d. In most of these cases, I do find that I can get what I want in mayavi, but still the matplotlib 3d axes are preferable, if only for aesthetics, like LaTeX-ified labels and visual consistency with my other figures. My question here is about the obvious hack: is it possible to draw some 3d object (a surface or 3d scatter plot or whatever) in mayavi without axes, export that image, then place