We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation General Mechanical Inversed Contour Legend Issue in MAPDL When Changing Legend Position Reply To: Inversed Contour Legend Issue in MAPDL When Changing Legend Position

wrbulat
Ansys Employee

Hello there,

Erik posted your request internally to us, his coworkers. After a lot of trial and error, I came up with something that might work for you:

 

Please copy the listing below into a text file and then read that file into an interactive MAPDL session with the /INPUT command.

fini
/cle
 
/vie,1,1,1,1
/vup,1,z
 
/prep7 ! TEST MODEL
bloc,,1,,1,,5
et,1,278
mp,kxx,1,60
vmes,all
nsel,s,loc,z
d,all,temp,22
nsel,s,loc,z,5
d,all,temp,100
alls
fini
 
/solu ! SOLVE
alls
solv
fini
 
/post1 ! POST PROCESSING
 
 
 
C*** FIRST CONTOUR PLOT USING DEFAULT COLORS, LEGEND NOT DISPLAYED
/plo,info,3
/plo,leg3,off
plns,temp
/wait,2
 
*get,minval,plns,,min ! minval = LOWEST NUMBER IN PREVIOUS CONTOUR PLOT
*get,maxval,plns,,max ! maxval = HIGHEST NUMBER IN PREVIOUS CONTOUR PLOT
 
 
C*** SECOND CONTOUR PLOT, ONLY LEGEND DISPLAYED w/REVERSED NUMBERS AND COLORS
/noe ! DON'T ERASE SCREEN
/plo,leg3,on ! DISPLAY LEGEND THIS TIME
/foc,1,5,,,1 ! SEND MODEL OUT OF FRAME OF GRAPHICS WINDOW
/udoc,1,cntr,left ! DISPLAY CONTOUR LEGEND ON LEFT
/contour,1,9,maxval,(maxval-minval)/9,minval ! REVERSE NUUMBERING ON CONTOUR LEGEND
 
/COLOR,CNTR,RED,1    ! REVERSE COLOR ASSIGNMENT ON CONTOUR LEGEND
/COLOR,CNTR,ORAN,2  
/COLOR,CNTR,YELL,3  
/COLOR,CNTR,YGRE,4  
/COLOR,CNTR,GREE,5  
/COLOR,CNTR,GCYA,6  
/COLOR,CNTR,CYAN,7  
/COLOR,CNTR,CBLU,8  
/COLOR,CNTR,BLUE,9  
 
plns,temp ! CREATE CONTOUR PLOT (MODEL NOT SHOWN, JUST LEGEND)
 
/reset ! RESET ALL GRAPHICS SETTINGS
 
 
/eof
 
I hope this works for you.

Kind regards,

Bill

Â