Create a horizontal bar graph
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | y | y-positions of the bars' centers |
|
real(kind=wp), | intent(in), | dimension(:) | :: | x | x-positions of the bars' tops |
|
real(kind=wp), | intent(in), | optional | dimension(:) | :: | c | Color scale for bars |
real(kind=wp), | intent(in), | optional | :: | relWidth | Relative width of bars |
|
character(len=*), | intent(in), | optional | :: | fillColor | Color of bar fills |
|
character(len=*), | intent(in), | optional | :: | fillPattern | Pattern of bar fills |
|
character(len=*), | intent(in), | optional | :: | lineColor | Color of lines around bars |
|
real(kind=wp), | optional | :: | lineWidth | Width of lines around bars |
subroutine barh(y,x,c,relWidth,fillColor,fillPattern,lineColor,lineWidth)
!! Create a horizontal bar graph
real(wp),dimension(:),intent(in)::y
!! y-positions of the bars' centers
real(wp),dimension(:),intent(in)::x
!! x-positions of the bars' tops
real(wp),dimension(:),intent(in),optional::c
!! Color scale for bars
real(wp),intent(in),optional::relWidth
!! Relative width of bars
character(*),intent(in),optional::fillColor
!! Color of bar fills
character(*),intent(in),optional::fillPattern
!! Pattern of bar fills
character(*),intent(in),optional::lineColor
!! Color of lines around bars
real(wp),optional::lineWidth
!! Width of lines around bars
real(pp),dimension(4)::xl,yl
real(pp),dimension(2)::cb
real(pp)::dy,dys
integer::k
cb = 0.0_wp
if(present(c)) cb = real(mixval(c),pp)
dys = 0.8_pp
if(present(relWidth)) dys = real(relWidth,pp)
dy = dys*real(y(2)-y(1),pp)/2.0_pp
if(present(lineWidth)) call setLineWidth(lineWidth)
do k=1,size(x)
yl = real([y(k)-dy,y(k)-dy,y(k)+dy,y(k)+dy],pp)
xl = real([0.0_wp,x(k),x(k),0.0_wp],pp)
if(present(fillColor)) call setColor(fillColor)
if(present(fillPattern)) call setFillPattern(fillPattern)
if(present(c)) call plcol1( real( (c(k)-cb(1))/(cb(2)-cb(1)) ,pp) )
call plfill(xl,yl)
if(present(lineColor)) call setColor(lineColor)
call plline(xl,yl)
end do
call resetPen()
end subroutine barh