Exemple #1
0
import matplotlib.pyplot as plt
import numpy as np

from plotting.paramplotter import ParamPlotter
from dataset import Dataset


def transfer(x):
    return np.array([x, x, x, 1.0])

fig = plt.figure(figsize=[6, 6])
dataset = Dataset(1, 1)
splineInterval = np.array([0.0, 1.0])
p = ParamPlotter(plt, splineInterval)
p.plotScalarField(dataset.rho, transfer)

fig.tight_layout()
plt.savefig("output/vg/scalar.pdf", format="pdf", transparent=True)
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as plt
import numpy as np

from plotting.paramplotter import ParamPlotter
from dataset import Dataset
import datasets.peakstransfer as transfer


fig = plt.figure(figsize=[8, 6])
gs = GridSpec(1, 1)
ax = fig.add_subplot(gs[0, 0])

dataset = Dataset(1, 1)
splineInterval = np.array([0.0, 1.0])
t = transfer.createTransferFunction()

p = ParamPlotter(ax, splineInterval, precision=1000)
cax = p.plotScalarField(dataset.rho, t)
ax.set_aspect('equal')
cbar = fig.colorbar(cax, ticks=[0.0, 1.0])
cbar.ax.set_yticklabels(['0.0', '1.0']) # Workaround for the ticks being converted to integers
cbar.solids.set_edgecolor('face') # Removes buggy lines in vector graphics

fig.tight_layout()
plt.savefig("output/vg/scalartransfer.pdf", format="pdf", transparent=True)
Exemple #3
0
newtonTolerance = 1e-5
dataset = Dataset(1, 1, 1)
splineInterval = np.array([0.0, 1.0])

phi = dataset.phi
rho = dataset.rho
phiPlane = SplinePlane(phi, splineInterval, newtonTolerance)
boundingBox = phiPlane.createBoundingBox()
splineModel = SplineModel(None, phiPlane, rho)

s = SplinePlotter(ax, splineInterval)
s.pointMarker = 'o'
s.pointColor = Color.POINT
s.rayColor = 'k'

p = ParamPlotter(ax2, splineInterval)
p.gridColor = Color.DIRECT

s.plotGrid(phi.evaluate, 10, 10, color=Color.DIRECT)
p.plotGrid(10, 10)
s.plotBoundingBox(boundingBox, edgecolor=Color.BOUNDINGBOX)

p.pointMarker = None
p.pointColor = 'k'
p.connectPoints = True
splineModel.generateScalarMatrix(boundingBox, 1000, texDimSize, newtonTolerance, paramPlotter=p)

p.pointMarker = 'o'
p.pointColor = Color.POINT
p.connectPoints = False