hist Subroutine

public subroutine hist(d, N, db, relWidth, fillColor, fillPattern, lineColor, lineWidth)

Arguments

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

Data for binning

integer, intent(in), optional :: N

Number of bins

real(kind=wp), intent(in), optional dimension(2):: db

Boundaries of bin range

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 histogram

Calls

proc~~hist~~CallsGraph proc~hist hist proc~bindata binData proc~hist->proc~bindata interface~mixval mixval proc~hist->interface~mixval proc~bar bar proc~hist->proc~bar proc~linspace linspace proc~bindata->proc~linspace proc~bar->interface~mixval plline plline proc~bar->plline plcol1 plcol1 proc~bar->plcol1 plfill plfill proc~bar->plfill
Help

Called By

proc~~hist~~CalledByGraph proc~hist hist proc~dohist doHist proc~dohist->proc~hist program~examples_prg examples_prg program~examples_prg->proc~dohist
Help

Variables

TypeVisibility AttributesNameInitial
real(kind=wp), public, dimension(:,:), allocatable:: h
real(kind=wp), public, dimension(2):: dbl
integer, public :: Nl
real(kind=wp), public :: relWidthl
real(kind=wp), public :: lineWidthl

Source Code

	subroutine hist(d,N,db,relWidth,fillColor,fillPattern,lineColor,lineWidth)
		!! Create a histogram
		real(wp),dimension(:),intent(in)::d
			!! Data for binning
		integer,intent(in),optional::N
			!! Number of bins
		real(wp),dimension(2),intent(in),optional::db
			!! Boundaries of bin range
		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(wp),dimension(:,:),allocatable::h
		real(wp),dimension(2)::dbl
		integer::Nl
		
		real(wp)::relWidthl
		real(wp)::lineWidthl
		
		Nl = 20
		if(present(N)) Nl = N
		
		if(present(db)) then
			dbl = db
		else
			dbl = mixval(d)+[-1.0_wp,1.0_wp]*epsilon(1.0_wp)
		end if
		
		h = binData(d,Nl,dbl,normalize=3)
		
		relWidthl = 1.0_wp
		if(present(relWidth)) relWidthl = relWidth
		lineWidthl = 0.5_wp
		if(present(lineWidth)) lineWidthl = lineWidth
		
		if(present(lineColor)) then
			if(present(fillColor)) then
				if(present(fillPattern)) then
					call bar(h(:,1),h(:,2),relWidth=relWidthl,lineColor=lineColor,lineWidth=lineWidthl, &
					& fillColor=fillColor,fillPattern=fillPattern)
				else
					call bar(h(:,1),h(:,2),relWidth=relWidthl,lineColor=lineColor,lineWidth=lineWidthl, &
					& fillColor=fillColor)
				end if
			else
				if(present(fillPattern)) then
					call bar(h(:,1),h(:,2),h(:,2),relWidth=relWidthl,lineColor=lineColor,lineWidth=lineWidthl, &
					& fillPattern=fillPattern)
				else
					call bar(h(:,1),h(:,2),h(:,2),relWidth=relWidthl,lineColor=lineColor,lineWidth=lineWidthl)
				end if
			end if
		else
			if(present(fillColor)) then
				if(present(fillPattern)) then
					call bar(h(:,1),h(:,2),relWidth=relWidthl,lineWidth=lineWidthl, &
					& fillColor=fillColor,fillPattern=fillPattern)
				else
					call bar(h(:,1),h(:,2),relWidth=relWidthl,lineWidth=lineWidthl, &
					& fillColor=fillColor)
				end if
			else
				if(present(fillPattern)) then
					call bar(h(:,1),h(:,2),h(:,2),relWidth=relWidthl,lineWidth=lineWidthl, &
					& fillPattern=fillPattern)
				else
					call bar(h(:,1),h(:,2),h(:,2),relWidth=relWidthl,lineWidth=lineWidthl)
				end if
			end if
		end if

		
		call resetPen()
	end subroutine hist