gnuplot에서 막대 차트를 어떻게 플로팅합니까?
텍스트 레이블이있는 gnuplot에서 막대 차트를 어떻게 플로팅하고?
간단한 막대 그래프 :
set boxwidth 0.5
set style fill solid
plot "data.dat" using 1:3:xtic(2) with boxes
data.dat :
0 label 100
1 label2 450
2 "bar label" 75
막대의 스타일을 다르게 지정하는 경우 다음과 같이 할 수 있습니다.
set style line 1 lc rgb "red"
set style line 2 lc rgb "blue"
set style fill solid
set boxwidth 0.5
plot "data.dat" every ::0::0 using 1:3:xtic(2) with boxes ls 1, \
"data.dat" every ::1::2 using 1:3:xtic(2) with boxes ls 2
각 항목에 대해 여러 막대를 수행하려는 경우 :
data.dat :
0 5
0.5 6
1.5 3
2 7
3 8
3.5 1
gnuplot :
set xtics ("label" 0.25, "label2" 1.75, "bar label" 3.25,)
set boxwidth 0.5
set style fill solid
plot 'data.dat' every 2 using 1:2 with boxes ls 1,\
'data.dat' every 2::1 using 1:2 with boxes ls 2
까다 롭고 깔끔한 gnuplot 트릭을 사용하려는 경우 :
Gnuplot에는 색상 색인으로 사용할 수있는 의사 열이 있습니다.
plot 'data.dat' using 1:2:0 with boxes lc variable
또한 함수를 사용하여 원하는 색상을 선택할 수 있습니다.
mycolor(x) = ((x*11244898) + 2851770)
plot 'data.dat' using 1:2:(mycolor($0)) with boxes lc rgb variable
참고 : 샘플 이미지와 동일한 효과를 얻으려면 몇 가지 다른 명령을 추가해야합니다.
히스토그램이있는 xtic (1)을 사용하여 "data.dat"플로팅
여기서 data.dat에는 다음 형식의 데이터가 포함됩니다.
제목 1 title2 3 "긴 제목"5
나는 답을 읽고 구문의 폭주로 인해 혼란 스러웠 기 때문에 절대적으로 사용을 위해 GNUPlot을 최상위 답변을 확장하고 싶습니다.
GNUplot 명령의 텍스트 파일을 작성하는 것으로 시작합니다. 그것을 commands.txt라고 부를 수 있습니다 :
set term png
set output "graph.png"
set boxwidth 0.5
set style fill solid
plot "data.dat" using 1:3:xtic(2) with boxes
set term png
GNUplot이 .png 파일을 출력하도록 설정하고 출력 할 파일 set output "graph.png"
의 이름입니다.
다음 두 줄은 다소 자명합니다. 다섯 번째 줄에는 많은 구문이 포함되어 있습니다.
plot "data.dat" using 1:3:xtic(2) with boxes
"data.dat"
작업중인 데이터 파일입니다. 1:3
x 좌표에는 data.dat의 열 1을 사용하고 y 좌표에는 data.dat의 열 3을 사용할 것임을 나타냅니다. xtic()
x 축의 번호 매기기 / 레이블 지정을 담당하는 함수입니다. xtic(2)
따라서 레이블에 data.dat의 열 2를 사용할 것임을 나타냅니다.
"data.dat"는 다음과 같습니다.
0 label 100
1 label2 450
2 "bar label" 75
그래프를 그리려면 gnuplot commands.txt
터미널에 입력하십시오 .
Derek Bruening의 막대 그래프 생성기 Perl 펼치기를 권장합니다. http://www.burningcutlery.com/derek/bargraph/ 에서 사용 가능
gnuplot에서 제공하는 스타일 히스토그램을 직접 사용할 수 있습니다. 다음은 출력에 두 개의 파일이있는 경우의 예입니다.
set style data histograms
set style fill solid
set boxwidth 0.5
plot "file1.dat" using 5 title "Total1" lt rgb "#406090",\
"file2.dat" using 5 title "Total2" lt rgb "#40FF00"
참고 URL : https://stackoverflow.com/questions/327576/how-do-you-plot-bar-charts-in-gnuplot
'IT' 카테고리의 다른 글
Javascript로만 Google 스프레드 시트에 액세스해야합니까? (0) | 2020.08.30 |
---|---|
알파벳 목록 끝에 항목을 배치하는 데 사용할 문자는 무엇입니까? (0) | 2020.08.30 |
[필터링 됨]에 등록 된 [쿼리] 없음 (0) | 2020.08.30 |
정수 나누기 : 왜 1/3 == 0의 결과입니까? (0) | 2020.08.30 |
numpy 배열을 튜플로 변환 (0) | 2020.08.30 |