我试图根据z值为线框图着色.我在互联网上找不到任何代码示例.
下面是一个表面图的示例,其中包含我想要的颜色和线框图,我无法在线上获取颜色:
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
# some numbers for the data
P=12000 #W
Q=1 #kg/s
DT=3 #K
cp=4169.32 #J/kgK
dDT=np.logspace(-2,0,20,endpoint=True)
dQ=Q*np.logspace(-3,-1,20,endpoint=True)
# the plotting data
m1,m2=np.meshgrid(dDT,dQ)
err=cp*np.sqrt((m1*Q)**2+(m2*DT)**2)/P
# the wiremesh plot that i need fixed
fig=plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(m1, m2, err, color=err/err.max(),cmap='jet')
ax.set_xlabel('dDT')
ax.set_ylabel('DQ')
ax.set_zlabel('relative error')
# the surface plot that has the colors i want
fig = plt.figure()
ax = fig.gca(projection='3d')
surf = ax.plot_surface(m1, …Run Code Online (Sandbox Code Playgroud) 我找到了这个关于动画的精彩短篇教程:
http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/
但是我不能制作一个同样时尚的动画imshow()情节.我试图替换一些行:
# First set up the figure, the axis, and the plot element we want to animate
fig = plt.figure()
ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
#line, = ax.plot([], [], lw=2)
a=np.random.random((5,5))
im=plt.imshow(a,interpolation='none')
# initialization function: plot the background of each frame
def init():
im.set_data(np.random.random((5,5)))
return im
# animation function. This is called sequentially
def animate(i):
a=im.get_array()
a=a*np.exp(-0.001*i) # exponential decay of the values
im.set_array(a)
return im
Run Code Online (Sandbox Code Playgroud)
但我遇到了错误,你可以帮助我运行吗?先感谢您.最好,
我试图将一些数据放入imshow()图中.我的问题是数据不是作为MxN数组而是作为3xN数组(x和y坐标和值).这些点不是作为规则网格排列,而是位于[xmin,xmax,ymin和ymax] = [ - pi/2,pi/2,0,3.5]之内.
In [117]: shape(data)
Out[117]: (3L, 102906L)
Run Code Online (Sandbox Code Playgroud)
如何从该数据中获得漂亮的图像图?非常感谢您的帮助.
顺便说一下,数据表示杆的表面上的温度值是轴向和方位角位置的函数,可以想象为cfd-mesh.
我很难将我想要的格式应用于电子表格。一个小例子可以在这里找到。
我有很多行数字,我想用相同的格式有条件地格式化每一行,但每一行都是独立的。但是当我填充第一行时,条件格式的范围会扩展到整个范围,并且颜色不再基于行。
如何基于行有条件地格式化我的行并将其放大到几百行?
手动输入不是一种选择。
(特殊粘贴-> 仅条件格式将导致与向下填充相同。)
我正在遵循教程并在 hello world 示例函数中收到编译错误。
这是怎么回事?
这是我尝试过的代码:
Function hi()
hi = "hello world"
End Function`
Run Code Online (Sandbox Code Playgroud)
我制作了一个基本的仪表板,如下所示,本文底部附有工作的最小示例。我想(但不知道如何)将滑块和(当前硬编码为 500 像素)居中放置大约 80% 的图形宽度,以响应浏览器窗口大小。我怎样才能做到这一点?谢谢!
[元信息:我很感激有关在哪里寻找/如何搜索此类主题的建议;我似乎在谷歌上搜索错误的东西,并且很难将 Dash 文档的各个部分放在一起] [
] 1
import dash
import dash_table
import dash_daq as daq
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
# pydata stack
import pandas as pd
from sqlalchemy import create_engine
def makeplot(slider):
gobar=[go.Bar(
x=[1,2,3],
y=[1,slider,5],
name='I am {}'.format(slider)) ]
content= {
'data':gobar,
'layout':dict(title='Mygraph')
}
return content
## layout
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
## app
app.layout …Run Code Online (Sandbox Code Playgroud) matplotlib ×3
image ×2
animation ×1
colors ×1
dataformat ×1
html ×1
plot ×1
plotly-dash ×1
positioning ×1
python ×1
slider ×1
vba ×1
wireframe ×1