bar Subroutine

public subroutine bar(x, y, c, relWidth, fillColor, fillPattern, lineColor, lineWidth)

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in), dimension(:):: x

x-positions of the bars' centers

real(kind=wp), intent(in), dimension(:):: y

y-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 (default 0.8)

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

Description

Create a bar graph

Calls

proc~~bar~~CallsGraph proc~bar bar plline plline proc~bar->plline plcol1 plcol1 proc~bar->plcol1 interface~mixval mixval proc~bar->interface~mixval plfill plfill proc~bar->plfill
Help

Called By

proc~~bar~~CalledByGraph proc~bar bar proc~dobar doBar proc~dobar->proc~bar proc~hist hist proc~hist->proc~bar proc~dohist doHist proc~dohist->proc~bar proc~dohist->proc~hist program~examples_prg examples_prg program~examples_prg->proc~dobar program~examples_prg->proc~dohist
Help

Variables

TypeVisibility AttributesNameInitial
real(kind=pp), public, dimension(4):: xl
real(kind=pp), public, dimension(4):: yl
real(kind=pp), public, dimension(2):: cb
real(kind=pp), public :: dx
real(kind=pp), public :: dxs
integer, public :: k

Source Code

	subroutine bar(x,y,c,relWidth,fillColor,fillPattern,lineColor,lineWidth)
		!! Create a bar graph
		real(wp),dimension(:),intent(in)::x
			!! x-positions of the bars' centers
		real(wp),dimension(:),intent(in)::y
			!! y-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 (default 0.8)
		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)::dx,dxs
		integer::k
		
		cb = 0.0_wp
		if(present(c)) cb = real(mixval(c),pp)
		dxs = 0.8_pp
		if(present(relWidth)) dxs = real(relWidth,pp)
		if(size(x)>1) then
			dx = dxs*real(x(2)-x(1),pp)/2.0_pp
		else
			dx = dxs
		end if
		
		if(present(lineWidth)) call setLineWidth(lineWidth)
		
		do k=1,size(x)
			xl = real([x(k)-dx,x(k)-dx,x(k)+dx,x(k)+dx],pp)
			yl = real([0.0_wp,y(k),y(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 bar