python - How can I define colors and their range for a colorbar in matplotlib and offset data? -


until used gnuplot visualize data , have low experience in matplotlib , python. have file containing values (x,y,f1(x,y),f2(x,y),...). want 2d scatter plot, points (x,y) colored f(x,y). how can plot offset e.g. f(x,y)-1 , how can define palette of colorbar.

currently python script looks (the following script uses predefined color map coolwarm, need self-defined ones different lines of data):

import matplotlib import matplotlib.pyplot plt import numpy np import pylab pl import math matplotlib.ticker import multiplelocator  x = np.loadtxt('disk_int_500p_a0000_theta45_r1d03.dat',                  unpack=true)  plt.scatter(x[0], x[1], marker='+', s=150, linewidths=4, c=x[2], cmap=plt.cm.coolwarm) plt.colorbar()      plt.show() 

the script used in gnuplot looked this, shows mean offset e.g. ($4 - 1.0) , mean defining colorbar set palette defined (z_min "blue", z_max/10 "green", z_max/3 "orange", z_max "red"):

data = 'disk_int_500p_a0000_theta45_r1d03'  set size square set xrange[-22:22]  set yrange[-22:22] set view map  set xlabel '$\alpha$ [m]' set ylabel '$\beta$ [m]'  set object 1 rectangle graph 0,0 graph 1,1 fillcolor rgb "black" behind  stats data.'.dat' using ($4 - 1.0) name "z"   set palette defined (z_min "blue", z_max/10 "green", z_max/3 "orange", z_max "red")  splot data.'.dat' using ($1):($2):($4 - 1.0) points pointtype 0 palette 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -