如何解决旋转直方图的代码? [英] How can solve the code of a rotated histogram?

查看:35
本文介绍了如何解决旋转直方图的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

整个stackoverflow组,

在图形中定义轴范围时遇到了一系列问题和格式,我想与大家分享一下,看看我们中是否可以找到错误

我在此网站上找到与之相似的用户.我的想法是使类似下面的链接的图形.但是由于某种原因,它可能很愚蠢,无法正确显示.

我的代码如下:

 设置词后eps增强颜色"Times-Roman" 14设置输出"ComparacionPurezaMetodos.eps"设置钥匙设置样式数据直方图设置样式直方图聚类间隙1设置样式填充实线边框-1设置boxwidth 0.8设置Xtic旋转90比例0未定论设置y2tics旋转90设置y2label'Ti_3SiC_2含量,wt {/Symbol \ 045}'偏移-2.5#set xlabel''设定尺寸0.6、1在图表0.5处设置标签粉末混合物",中心旋转-0.1到180使用1:(-1):3的标签向右旋转'datos.txt',使用1:2的方框绘制'datos.txt' 

数据非常简单:

 #索引,纯度,名称1 98钛/硅/钛2 94 Ti/TiSi_2/TiC3 93.6钛/硅/碳4 92 Ti/SiC/TiC5 93钛/碳化硅/碳6 98钛/硅/碳+铝 

,我希望得到此链接第1章的图4(第6页)所示的输出图像:

Hi to whole stackoverflow group,

I am having a series of problems when defining the axes range in my graphic and format in general, and I would like to share it with you to see if among all we can find the error

I have found on this website a user who has made it similar. My idea is to have something similar like the graphic of the link below. But for some reason, it's probably silly, it does not appear correctly.

My code is as following:


set term post eps enhanced color "Times-Roman" 14
set output "ComparacionPurezaMetodos.eps"

set key off 
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.8
set xtic rotate by 90 scale 0
unset ytics
set y2tics rotate by 90

set y2label 'Ti_3SiC_2 content, wt{/Symbol\045}'  offset -2.5

#set xlabel ' '
set size 0.6, 1

set label 'Powder mixture' at graph 0.5, -0.1 centre rotate by 180


plot 'datos.txt' using 1:(-1):3 with labels rotate right, 'datos.txt' using 1:2 with boxes


and the data are very simple:

# index, purity, name
1 98 Ti/Si/TiC
2 94 Ti/TiSi_2/TiC
3 93.6 Ti/Si/C
4 92 Ti/SiC/TiC
5 93 Ti/SiC/C
6 98 Ti/Si/C + Al

and I expect an output image like figure 4 (pag 6) of chapter 1 of this link: https://books.google.es/books?id=zNWeBQAAQBAJ&printsec=frontcover&hl=es#v=onepage&q&f=false

But my output file does not have to do with this image.

Any idea / help?

Thanks in advance.

解决方案

For your data, you don't need a histogram. Horizontal bars are sufficient. Instead of rotating a graph with plotting style with boxes you can use the plotting style with boxxyerror. Make sure that your data separator is TAB or put your labels into "...".

### horizontal bars
reset session
set colorsequence classic
set datafile separator "\t"

$Data <<EOD
# index, purity, name
1   98  Ti/Si/TiC
2   94  Ti/TiSi_2/TiC
3   93.6    Ti/Si/C
4   92  Ti/SiC/TiC
5   93  Ti/SiC/C
6   98  Ti/Si/C + Al
EOD

unset key
set xlabel "Ti_2SiC_2 content, wt%" enhanced
set xrange [90:100]
set ylabel "Powder mixture"
unset ytics
set yrange [0:7]

set style fill solid 1.0
plot $Data u 2:1:(0):2:($1-0.4):($1+0.4):1 with boxxyerror lc variable,\
    '' u 2:1:3 with labels offset 1,0 left
### end of code

Result:

这篇关于如何解决旋转直方图的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆