我想为x轴添加一个标签,并为y轴添加一个标签。
另外,如果能让colorbar标题离colorbar多一点空间,我们将不胜感激。
我已经标记了需要# <---- Help Please!帮助的地方
# this chunk seems to be necessary for plotting in my virtualenv.
import matplotlib
matplotlib.use('TkAgg')
% matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import n
我试图使用matplotlib / seaborn将数据标签添加到双轴图的一部分,但似乎找不到让标签显示的解决方案。
# Pandas for managing datasets
import pandas as pd
# Matplotlib for additional customization
from matplotlib import pyplot as plt
%matplotlib inline
# Seaborn for plotting and styling
import seaborn as sns
# Sample data
data = {'Perfo
我使用LaTex中的rotate包将图表旋转了270°,从而制作了一个水平直方图。这是没有问题的调整所有的标签和抽屉,但我没有找到一个方法来旋转钥匙。
下面是我的gnuplot代码:
set terminal epslatex size 16cm, 32cm
set output "stackexchange.tex"
set xrange [-1:8]
set key
set boxwidth 0.95
set style data histograms
set style histogram errorbars
set style fill solid 0.8
我在同一张图上绘制双柱形图和折线图。对于第一个和最后一个x-tick,图表中只有一个条形可见。中间所有的x-tick都有双条(正如我所希望的)。
这是我使用的代码:
for h in range(0,len(x)): # len(x) is > 4000
if h > 0 :
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.set_xlim([-1,13])
ax2 = ax1.twinx()
df2[[
有了足够的旋转,我的条形图的列的标签就会被砍掉。这里有一个示例,它应该说明发生了什么:
import matplotlib.pyplot as plt
x = [1,2,3]
y = [2,3,4]
s = ['long_label_000000000','long_label_000000001','long_label_000000002']
plt.bar(x,y)
plt.xticks(range(len(s)),s, rotation=90)
plt.show()
我知道执行以下操作将导致图形根据画布大小自动调整:
from matp
在3D中tic标签的旋转可能是必要的,特别是如果您有许多文本tic标签,如果没有旋转,或者为了得到更好的tic标签之间的分离,这些标签可能会重叠。旋转在2D是没有问题的。
脚本:(由于set boxdepth需要gnuket5.4.0)
### how to rotate xticlabels in 3D?
reset session
$Data <<EOD
Alpha One 1.00
Alpha Two 2.00
Alpha Three 3.00
Alpha Four 4.00
Beta One 1.25
B
我想得到不同的情节,但得到一个数字与所有的情节。为什么?例如,我有两个脚本用于两个情节,但是python将它们合并到一个图像中。
import matplotlib.pyplot as plt
#% matplotlib inline
import seaborn as sns
# Use plot styling from seaborn.
sns.set(style='darkgrid')
# Increase the plot size and font size.
sns.set(font_scale=1.5)
plt.rcParams["figure.figs
我使用的是seaborn 0.11.2,但我在查看seaborn pairplot的传奇时遇到了麻烦。以下是代码:除了图例之外,所有的工作都很正常 for x in x1_categorical:
plt.figure()
sns.pairplot(data=x1[[x,'weight']],hue=x, palette='husl', height=4, aspect=4)
plt.title(x) 我既看不到颜色也看不到标签。我已经尝试过这里建议的方法:Seaborn Pairplot Legend Not Showing Colors
我正在尝试创建下面两个图像的组合。
基本上我想要密度图的设计,但围绕一个圆圈,而不是正常的X/Y图表设置。
下面是Python中密度图的代码。
# !pip install brewer2mpl
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import warnings; warnings.filterwarnings(action='once')
large = 22; m
我有以下图像:
使用以下代码创建:
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
# create some random data
data = pd.DataFrame(np.random.rand(11, 5), columns=['A', 'B', 'C', 'D', 'E'], index = ['yyyyyyyy - ' + str(x)
private let componentDimension: CGFloat = 40.0
private let componentCount: CGFloat = 5.0
private let componentActiveColor = UIColor.black
private let componentInactiveColor = UIColor.gray
func setup() {
//create 5 labels using for loop and store in array ///figure out how to add a number to
我尝试在Python语言中使用几个不同的库(bokeh、seaborn和matlotlib)绘制图形,但保持相同的配色方案。我已经从bokeh中选择了分类调色板:
from bokeh.palettes import Category10 as palette
然后还在seaborn和matplotlib中使用了它。我的问题是,尽管在matplotlib中的颜色看起来与bokeh非常相似(在调色板中定义),但seaborn显示的颜色在某种程度上比它应该显示的更暗(即不那么饱和或不饱和)。我想知道它是否在默认情况下使任何配色方案变暗,以及是否有任何方法可以避免这种情况。下面是使用不同的库制作相同
我正在使用rotateflip旋转图像,还保存在服务器上,这里是代码:
using (Image image = Image.FromFile(HttpContext.Current.Server.MapPath("~/Content/Job_Files/" + Job_ID + "/" + new_str + "/Images/" + path)))
{
//rotate the picture by 90 degrees and re-save the picture as a Jpeg
if (cbox_id == "