Commit c034e8f1 authored by Theo Steininger's avatar Theo Steininger

Improved Plotting

parent e3bc5346
Pipeline #15467 passed with stages
in 12 minutes and 37 seconds
......@@ -4,9 +4,9 @@ from nifty.plotting.plotly_wrapper import PlotlyWrapper
class Axis(PlotlyWrapper):
def __init__(self, text=None, font='', color='', log=False,
font_size=18, show_grid=True, visible=True):
self.text = text
def __init__(self, label=None, font='Balto', color='', log=False,
font_size=22, show_grid=True, visible=True):
self.label = str(label)
self.font = font
self.color = color
self.log = log
......@@ -16,9 +16,9 @@ class Axis(PlotlyWrapper):
def to_plotly(self):
ply_object = dict()
if self.text:
if self.label:
ply_object.update(dict(
title=self.text,
title=self.label,
titlefont=dict(
family=self.font,
color=self.color,
......@@ -30,5 +30,8 @@ class Axis(PlotlyWrapper):
if not self.show_grid:
ply_object['showgrid'] = False
ply_object['visible'] = self.visible
ply_object['tickfont'] = {'size': self.font_size}
ply_object['tickfont'] = {'size': self.font_size,
'family': self.font}
# ply_object['domain'] = {'0': '0.04',
# '1': '1'}
return ply_object
......@@ -11,8 +11,8 @@ class Figure2D(FigureFromPlot):
width = width if width is not None else plots[0].default_width()
height = \
height if height is not None else plots[0].default_height()
(xaxis, yaxis) = \
xaxis if xaxis is not None else plots[0].default_axes()
xaxis = xaxis if xaxis is not None else plots[0].default_axes()[0]
yaxis = yaxis if yaxis is not None else plots[0].default_axes()[1]
if isinstance(plots[0], Heatmap) and width is None and \
height is None:
......
......@@ -9,8 +9,9 @@ class Figure3D(FigureFromPlot):
width = width if width is not None else plots[0].default_width()
height = \
height if height is not None else plots[0].default_height()
(xaxis, yaxis, zaxis) = \
xaxis if xaxis is not None else plots[0].default_axes()
xaxis = xaxis if xaxis is not None else plots[0].default_axes()[0]
yaxis = yaxis if yaxis is not None else plots[0].default_axes()[1]
zaxis = zaxis if zaxis is not None else plots[0].default_axes()[2]
super(Figure3D, self).__init__(plots, title, width, height)
self.xaxis = xaxis
self.yaxis = yaxis
......
......@@ -22,7 +22,8 @@ class Heatmap(PlotlyWrapper):
self.data = data
self.zmin = zmin
self.zmax = zmax
self._font_size = 18
self._font_size = 22
self._font_family = 'Bento'
def at(self, data):
if isinstance(data, list):
......@@ -50,7 +51,8 @@ class Heatmap(PlotlyWrapper):
plotly_object['zmax'] = self.zmax
plotly_object['showscale'] = True
plotly_object['colorbar'] = {'tickfont': {'size': self._font_size}}
plotly_object['colorbar'] = {'tickfont': {'size': self._font_size,
'family': self._font_family}}
if self.color_map:
plotly_object['colorscale'] = self.color_map.to_plotly()
if self.webgl:
......
......@@ -42,7 +42,7 @@ class ScatterPlot(PlotlyWrapper):
return ply_object
def default_width(self):
return 700
return 1100
def default_height(self):
return 700
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment