Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple colour schemes in multiplot #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,10 @@ SOURCES= $(PLOTLIB) globaldata.f90 asciiutils.f90 \
exact_ringspread.f90 exact_gresho.f90 exact.f90 shapes.f90 \
allocate.f90 titles.f90 calc_quantities.f90 contours.f90 \
interpolate3D_projection.F90 legends.f90 \
options_limits.f90 options_page.f90 \
options_render.f90 options_particleplots.f90 \
adjust_data.f90 get_data.f90 \
options_data.f90 options_limits.f90 options_page.f90 \
options_powerspec.f90 \
options_data.f90 options_powerspec.f90 \
options_vecplot.f90 options_xsecrotate.f90 pdfs.f90 \
rotate.f90 interpolate1D.f90 interpolate2D.f90 \
interpolate3D.F90 interpolate3D_geom.F90 interpolate3D_xsec.f90 \
Expand Down
1 change: 1 addition & 0 deletions src/defaults.f90
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ subroutine defaults_set(use_evdefaults)
x_secmulti(:) = .false. ! take cross section?
xsecposmulti(:) = 0.0 ! position of cross section
icontourmulti(:) = 0 ! contour plot
icoloursmulti(:) = 2 ! colour schemes
iplotpartoftypemulti(:,:) = .false.
do i=1,size(iplotpartoftypemulti(:,1))
iplotpartoftypemulti(i,i) = .true.
Expand Down
4 changes: 2 additions & 2 deletions src/globaldata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ module multiplot
implicit none
integer :: nyplotmulti
integer, dimension(maxplot) :: multiplotx,multiploty
integer, dimension(maxplot) :: irendermulti,ivecplotmulti
integer, dimension(maxplot) :: irendermulti,ivecplotmulti,icoloursmulti
integer, dimension(maxplot) :: itrans,icontourmulti
logical, dimension(maxplot) :: x_secmulti
real, dimension(maxplot) :: xsecposmulti
Expand All @@ -173,7 +173,7 @@ module multiplot
namelist /multi/ nyplotmulti, &
itrans,multiplotx,multiploty,irendermulti, &
ivecplotmulti,icontourmulti,x_secmulti,xsecposmulti, &
iusealltypesmulti,iplotpartoftypemulti
iusealltypesmulti,iplotpartoftypemulti,icoloursmulti

public

Expand Down
18 changes: 10 additions & 8 deletions src/interactive.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1543,25 +1543,25 @@ end subroutine interactive_step
subroutine interactive_multi(iadvance,istep,ifirststeponpage,ilaststep,iframe,ifirstframeonpage,nframes, &
lastpanel,iplotxarr,iplotyarr,irenderarr,icontourarr,ivecarr,&
use_double_rendering,xmin,xmax,vptxmin,vptxmax,vptymin,vptymax, &
barwmulti,xminadapt,xmaxadapt,nacross,ndim,xorigin,icolourscheme, &
barwmulti,xminadapt,xmaxadapt,nacross,ndim,xorigin,icoloursarr, &
iColourBarStyle,interactivereplot)
use labels, only:is_coord,iamvec
use limits, only:assert_sensible_limits
use multiplot, only:itrans
use multiplot, only:itrans,nyplotmulti
use shapes, only:add_textshape,inshape,edit_shape,delete_shape,nshapes
use plotlib, only:plot_qcur,plot_band,plot_qwin,plot_pt1,plot_curs,plot_line,plot_left_click
implicit none
integer, intent(inout) :: iadvance
integer, intent(inout) :: istep,iframe,lastpanel,iColourBarStyle
integer, intent(in) :: ifirststeponpage,ilaststep,nacross,ndim,ifirstframeonpage,nframes
integer, intent(inout) :: icolourscheme
integer, intent(inout), dimension(:) :: icoloursarr
integer, intent(in), dimension(:) :: iplotxarr,iplotyarr,irenderarr,icontourarr,ivecarr
real, dimension(:), intent(in) :: vptxmin,vptxmax,vptymin,vptymax,barwmulti
real, dimension(:), intent(inout) :: xmin,xmax,xminadapt,xmaxadapt
real, intent(in), dimension(ndim) :: xorigin
logical, intent(in) :: use_double_rendering
logical, intent(out) :: interactivereplot
integer :: ierr,ipanel,ipanel2,istepin,istepnew,i,istepjump,istepsonpage,ishape
integer :: ierr,ipanel,ipanel2,istepin,istepnew,i,istepjump,istepsonpage,ishape,imultipanel
integer :: istepjumpnew,ivecx,ivecy
real :: xpt,ypt,xpt2,ypt2,xpti,ypti,renderpt,xptmin,xptmax,yptmin,yptmax
real :: xlength,ylength,renderlength,contlength,zoomfac
Expand Down Expand Up @@ -1612,6 +1612,7 @@ subroutine interactive_multi(iadvance,istep,ifirststeponpage,ilaststep,iframe,if
istepsonpage = abs(istep - ifirststeponpage)/iadvance + 1
istepjump = 1
istepjumpset = .false.

! print*,'istep = ',istepnew
! print*,'steps on page = ',istepsonpage

Expand All @@ -1634,6 +1635,7 @@ subroutine interactive_multi(iadvance,istep,ifirststeponpage,ilaststep,iframe,if
!
call get_vptxy(xpt,ypt,vptxi,vptyi)
ipanel = getpanel(vptxi,vptyi)
imultipanel = mod(ipanel-1, nyplotmulti) + 1
!print*,'xpt,ypt = ',xpt,ypt,vptxi,vptyi,ipanel

!--translate vpt co-ords to x,y in current panel
Expand Down Expand Up @@ -2113,18 +2115,18 @@ subroutine interactive_multi(iadvance,istep,ifirststeponpage,ilaststep,iframe,if
endif
endif
case('m') ! change colour map (next scheme)
call change_colourmap(icolourscheme,1)
call change_colourmap(icoloursarr(imultipanel),1)
istep = istepnew
interactivereplot = .true.
iexit = .true.
case('M') ! change colour map (previous scheme)
call change_colourmap(icolourscheme,-1)
call change_colourmap(icoloursarr(imultipanel),-1)
istep = istepnew
interactivereplot = .true.
iexit = .true.
case('i') ! invert colour map
icolourscheme = -icolourscheme
call change_colourmap(icolourscheme,0)
icoloursarr(imultipanel) = -icoloursarr(imultipanel)
call change_colourmap(icoloursarr(imultipanel),0)
istep = istepnew
interactivereplot = .true.
iexit = .true.
Expand Down
41 changes: 24 additions & 17 deletions src/options_render.f90
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ subroutine submenu_render(ichoose)
use kernels, only:select_kernel,kernelname,nkernels
use projections3D, only:setup_integratedkernel
use asciiutils, only:read_asciifile
use multiplot, only:icoloursmulti,nyplotmulti
use settings_page, only:nacross,ndown
implicit none
integer, intent(in) :: ichoose
character(len=5) :: string
Expand Down Expand Up @@ -167,24 +169,29 @@ subroutine submenu_render(ichoose)
write(*,"(i3,a,1x)") icustom,': custom'
print "(a)",'(-ve = inverse, 0 = contours only)'
promptloop: do while (ierr /= 0)
call prompt('enter colour scheme for rendering ',icolours,&
-ncolourschemes+1,ncolourschemes+1,icustom,icustom)
!
! custom colour map from file !demonstration plot of all colour schemes
!
ierr = 0
if (icolours==ncolourschemes+1) icolours=icustom
if (icolours==-(ncolourschemes+1)) icolours=-icustom
if (abs(icolours).eq.icustom) then
call prompt('enter filename for rgb table',rgbfile,noblank=.true.)
call read_asciifile(rgbfile,ncoltable,rgbtable,ierr)
if (ierr /= 0 .or. ncoltable <= 0) then
print "(a)",'ERROR: could not read colours from '//trim(rgbfile)
else
print "(a,i3,a)",'read ',ncoltable,' colours from '//trim(rgbfile)
do i=1,min(nacross*ndown,nyplotmulti)
call prompt('enter colour scheme for rendering ',icoloursmulti(i),&
-ncolourschemes+1,ncolourschemes+1,icustom,icustom)
ierr = 0
if (i==1) then
icolours = icoloursmulti(i)
!
! custom colour map from file !demonstration plot of all colour schemes
!
if (icolours==ncolourschemes+1) icolours=icustom
if (icolours==-(ncolourschemes+1)) icolours=-icustom
if (abs(icolours).eq.icustom) then
call prompt('enter filename for rgb table',rgbfile,noblank=.true.)
call read_asciifile(rgbfile,ncoltable,rgbtable,ierr)
if (ierr /= 0 .or. ncoltable <= 0) then
print "(a)",'ERROR: could not read colours from '//trim(rgbfile)
else
print "(a,i3,a)",'read ',ncoltable,' colours from '//trim(rgbfile)
endif
if (ierr /= 0) icolours = icolourprev
endif
endif
if (ierr /= 0) icolours = icolourprev
endif
enddo
enddo promptloop
!------------------------------------------------------------------------
case(3)
Expand Down
23 changes: 17 additions & 6 deletions src/plotstep.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ module timestep_plotting
real, private :: dxgrid,xmingrid,xmaxgrid
real, private :: angletempx, angletempy, angletempz
!--buffer for interactive mode on multiplots
integer, dimension(maxplot) :: iplotxtemp,iplotytemp,irendertemp,icontourtemp,ivecplottemp
integer, dimension(maxplot) :: iplotxtemp,iplotytemp,irendertemp
integer, dimension(maxplot) :: icontourtemp,ivecplottemp,icolourstemp
real, dimension(maxplot) :: xminmulti,xmaxmulti,xminadapt,xmaxadapt
real, dimension(maxplot) :: vptxmin,vptxmax,vptymin,vptymax,barwmulti
real, private :: xminadapti,xmaxadapti,yminadapti,ymaxadapti,renderminadapt,rendermaxadapt
Expand Down Expand Up @@ -86,7 +87,7 @@ subroutine initialise_plotting(ipicky,ipickx,irender_nomulti,icontour_nomulti,iv
ideltavsum,get_z_dir
use limits, only:lim,rangeset,limits_are_equal
use multiplot, only:multiplotx,multiploty,irendermulti,icontourmulti, &
nyplotmulti,x_secmulti,ivecplotmulti
nyplotmulti,x_secmulti,ivecplotmulti,icoloursmulti
use prompting, only:prompt
use titles, only:read_titles,read_steplegend
use settings_data, only:ndim,ndimV,numplot,ncolumns,ncalc,ndataplots,required, &
Expand Down Expand Up @@ -686,7 +687,7 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
use limits, only:lim,get_particle_subset,lim2,lim2set
use multiplot, only:multiplotx,multiploty,irendermulti,ivecplotmulti, &
itrans,icontourmulti,x_secmulti,xsecposmulti,&
iusealltypesmulti,iplotpartoftypemulti
iusealltypesmulti,iplotpartoftypemulti,icoloursmulti
use particle_data, only:maxpart,maxcol,icolourme
use settings_data, only:numplot,ndataplots,icoords,icoordsnew,ndim,ndimV,&
nfreq,iRescale,iendatstep,ntypes,&
Expand Down Expand Up @@ -986,6 +987,8 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
irender = irendermulti(nyplot)
ivectorplot = ivecplotmulti(nyplot)
icontourplot = icontourmulti(nyplot)
icolours = icoloursmulti(nyplot)
call colour_set(icolours)
iplotcont = .false. !iplotcontmulti(nyplot)
x_sec = x_secmulti(nyplot)
zslicepos = xsecposmulti(nyplot)
Expand All @@ -999,6 +1002,7 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
call set_weights(weight,dat,iamtype,(iusetype .and. UseTypeInRenderings))
endif
else
if (nacross*ndown .gt. 1) icolours=icoloursmulti(nyplot)
if (.not.interactivereplot) irender = irender_nomulti
ivectorplot = ivecplot
icontourplot = icontour_nomulti
Expand Down Expand Up @@ -2158,7 +2162,9 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
nframesloop,ipanel,iplotxtemp(1:nplots),iplotytemp(1:nplots),irendertemp(1:nplots),&
icontourtemp(1:nplots),ivecplottemp(1:nplots),double_rendering,xminmulti(:),xmaxmulti(:),&
vptxmin(1:nplots),vptxmax(1:nplots),vptymin(1:nplots),vptymax(1:nplots),barwmulti(1:nplots), &
xminadapt(:),xmaxadapt(:),nacross,ndim,xorigin(1:ndim),icolours,iColourBarStyle,interactivereplot)
xminadapt(:),xmaxadapt(:),nacross,ndim,xorigin(1:ndim),icolourstemp(1:nplots),iColourBarStyle, &
interactivereplot)
icoloursmulti(1:nplots) = icolourstemp(1:nplots)
if (iadvance.eq.-666 .or. interactivereplot) exit over_frames
endif
endif
Expand Down Expand Up @@ -2326,7 +2332,9 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
nframesloop,ipanel,iplotxtemp(1:nplots),iplotytemp(1:nplots),irendertemp(1:nplots),&
icontourtemp(1:nplots),ivecplottemp(1:nplots),.false.,xminmulti(:),xmaxmulti(:),&
vptxmin(1:nplots),vptxmax(1:nplots),vptymin(1:nplots),vptymax(1:nplots),barwmulti(1:nplots), &
xminadapt(:),xmaxadapt(:),nacross,ndim,xorigin(1:ndim),icolours,iColourBarStyle,interactivereplot)
xminadapt(:),xmaxadapt(:),nacross,ndim,xorigin(1:ndim),icoloursmulti(1:nplots),iColourBarStyle, &
interactivereplot)
icoloursmulti(1:nplots) = icolourstemp(1:nplots)
if (iadvance.eq.-666 .or. interactivereplot) exit over_frames
endif
endif
Expand Down Expand Up @@ -2502,7 +2510,9 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
nframesloop,ipanel,iplotxtemp(1:nplots),iplotytemp(1:nplots),irendertemp(1:nplots),&
icontourtemp(1:nplots),ivecplottemp(1:nplots),.false.,xminmulti(:),xmaxmulti(:),&
vptxmin(1:nplots),vptxmax(1:nplots),vptymin(1:nplots),vptymax(1:nplots),barwmulti(1:nplots), &
xminadapt(:),xmaxadapt(:),nacross,ndim,xorigin(1:ndim),icolours,iColourBarStyle,interactivereplot)
xminadapt(:),xmaxadapt(:),nacross,ndim,xorigin(1:ndim),icoloursmulti(1:nplots),iColourBarStyle, &
interactivereplot)
icoloursmulti(1:nplots) = icolourstemp(1:nplots)
if (iadvance.eq.-666 .or. interactivereplot) exit over_frames
endif
cycle over_plots
Expand Down Expand Up @@ -3088,6 +3098,7 @@ subroutine page_setup(dummy)
irendertemp(ipanel) = irender
icontourtemp(ipanel) = icontourplot
ivecplottemp(ipanel) = ivectorplot
icolourstemp(ipanel) = icolours
xminmulti(iplotx) = xmin
xmaxmulti(iplotx) = xmax
xminmulti(iploty) = ymin
Expand Down