Skip to content

[GNUPLOT] Histogram rowstacked

by on 29 December 2011

Assalamu’alaikum wr wb,

 

Hola….. Akhirnya posting pertama kami, eng ing eng….

Bagian pertama ini kami isi dengan panduan script pada GNUPLOT dengan bash untuk membuat grafik histogram. Kali ini Histogram rowstacked, artinya grafik batang yang biasanya dipakai untuk menggambarkan komposisi per bagian tertentu dari suatu kategori tertentu.

Berikut ini contoh datanya (data demo1.dat):

Dan berikut ini script-nya:

#!/bin/bash
dir=/home/dir/Documents/project/GNUPLOTdemo
gnuplot <set term postscript enhanced color
 set output "$dir/demo1a.ps"
 set datafile missing "NaN"
 set style data histogram
 set style histogram rowstacked
 set style fill pattern border 1
 set boxwidth 0.75
 set ylabel "Value" font "Arial,18"
 set xlabel "Category" font "Arial,18"
 set xtics nomirror norotate
 set key outside right top vertical Left reverse enhanced autotitles columnhead nobox
 set key samplen 3 spacing 1 width 0 height 0
 set xtics ("K" 0, "L" 1, "M" 2, "N" 3, "O" 4)
 plot "demo1.dat" using 2 fs pattern 1, \
 '' using 3 fs pattern 2,\
 '' using 4 fs pattern 4,\
 '' using 5 fs pattern 22, \
 '' using 6 fs pattern 5, \
 '' using 7 fs pattern 6, \
 '' using 8 fs pattern 7, \
 '' using 9 fs pattern 8, \
 '' using 10 fs pattern 9, \
 '' using 11 fs pattern 10,\
 '' using 12 fs pattern 60
 EOF

Wassalamu’alaikum wr wb.

From → GNUPLOT

One Comment

Trackbacks & Pingbacks

  1. Histogram rowstacked (2) « sweetplots

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.