警告:我对python的使用非常陌生。
我试图使用误差条来绘制数据,但我的数据在误差条的上下有不同的值,即2+.75,2-.32。
import numpy as np
import matplotlib.pyplot as plt
# example data
x = (1,2,3,4)
y = (1,2,3,4)
# example variable error bar values
yerr = 0.2
plt.figure()
plt.errorbar(x, y, yerr,"r^")
plt.show()
但是我希望点上的误差条是一个特定值,比如.17,点下的错
我喜欢绘制简单的时间序列数据和过量绘制降水数据。下面的代码为通常的数据绘制一行,并为降水数据添加条形图(或直方图条)。
D # a simple (zoo) time series
P # a simple (zoo) time series of precipitation
plot(D, type="l")
lines(P, type="h", lwd=5)
但这些条是基于y=0轴和上升的顶部。但在水文学中,通常是以最上面的轴和向下的“流”为基础的降水条。D有任意的y-范围,所以我更希望有一种解决方案来修复P基线的值。
我在谷歌上搜索了很多,但没有找到如何在
我有多个CSV文件,其中只包含一行,如下所示:
y,ymin,ymax
例如:
35.4587,36.6542,34.3546
我想做一个带有误差条的直方图,看起来像这样:
但我有这样的想法:
因为我不知道如何分隔这些框,以及如何为它们指定任意标签,而不管我绘制的是什么数据。
到目前为止,我的代码如下:
reset
set datafile separator ','
set style fill solid 1 border lt -1
set style histogram errorbars gap 2 lw 2
set style data hi
如何更改柱状叠加直方图的填充颜色?我的数据看起来是:
xticlabel_1 xticlabel_2 xticlabel_3
10 20 15
我的剧本是:
set datafile separator "\t"
set term postscript colour solid
set size 1,0.5
set output 'duplication_stats.eps'
set style data histograms
set style histogram columnstacked
set boxwidth 0.5
set style fill so
我试图并排绘制2条直方图,第一条用于整个数据集,第二条用于数据集的子集。为了具有可比性,我希望具有相同的类间隔,并且必须按照Freedman规则计算bin宽度(可能是sns.histplot根据堆栈溢出回答使用的默认模式)。
我希望第一个直方图的回收箱是由sns.histplot()函数决定的默认值。
然后,我想提取第一个图所使用的bin间隔或断点的列表,并使用它作为参数,同时生成第二个直方图。
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from s