|  |  |  | [[_TOC_]] | 
|  | # Simple plot of 1D data |  | # Simple plot of 1D data | 
|  | The example below demonstrates how to plot 1D data, precisely: |  | The example below demonstrates how to plot 1D data, precisely: | 
|  | ``` |  | ``` | 
| ... | @@ -37,4 +38,47 @@ fig.savefig("rho_a.png") | ... | @@ -37,4 +38,47 @@ fig.savefig("rho_a.png") | 
|  | plt.show() |  | plt.show() | 
|  | ``` |  | ``` | 
|  | The result of this example: |  | The result of this example: | 
|  |  |  |  | 
|  | \ No newline at end of file |  |  | 
|  |  |  | # Simple plot of 2D data | 
|  |  |  | The example below demonstrates how to plot 1D data, precisely: | 
|  |  |  | ``` | 
|  |  |  | datadim                   2   # dimension of block size: 1=nx, 2=nx*ny, 3=nx*ny*nz | 
|  |  |  | ``` | 
|  |  |  | The simple plotting script may look like: | 
|  |  |  | ```python | 
|  |  |  | #!/usr/bin/python3 | 
|  |  |  |  | 
|  |  |  | # Before run: | 
|  |  |  | # Get wata lib: | 
|  |  |  | #   pip3 install wdata | 
|  |  |  | # (add -U if you want to update) | 
|  |  |  | # For more info see: | 
|  |  |  | #   https://pypi.org/project/wdata/ | 
|  |  |  |  | 
|  |  |  |  | 
|  |  |  | import numpy as np | 
|  |  |  | import matplotlib.pyplot as plt | 
|  |  |  | import matplotlib.cm as cm | 
|  |  |  | from wdata.io import WData, Var | 
|  |  |  |  | 
|  |  |  | # I read data directly from dwarf, | 
|  |  |  | # Before running the script I mounted file system: | 
|  |  |  | # sshfs gabrielw@dwarf.if.pw.edu.pl:/home2/ /home/gabrielw/home2-dwarf/ | 
|  |  |  |  | 
|  |  |  | fwtxt="/home/gabrielw/home2-dwarf/archive/ntg/repository/atomicjj/CALC-BCS/td-round5-bcs/td1-bcs-z0.02-V0.6.wtxt" | 
|  |  |  | data = WData.load(fwtxt) | 
|  |  |  |  | 
|  |  |  | ratio=data.Nxyz[0]/data.Nxyz[1] | 
|  |  |  | scale=2.0 | 
|  |  |  | fig, ax = plt.subplots(figsize=(scale*ratio,1.2*scale)) | 
|  |  |  |  | 
|  |  |  | im = ax.imshow(np.transpose(data.rho_a[0]), interpolation='bilinear', extent=[0, data.Nxyz[0], 0, data.Nxyz[1]], aspect='auto') | 
|  |  |  | fig.colorbar(im, ax=ax, orientation="horizontal") | 
|  |  |  |  | 
|  |  |  | plt.tight_layout() | 
|  |  |  | fig.savefig("rho_a.png") | 
|  |  |  | plt.show() | 
|  |  |  | ``` | 
|  |  |  | The result of this example: | 
|  |  |  |  | 
|  |  |  | \ No newline at end of file |