plotly bar chart annotate text cut-off - python

The annotation text at the last bar has been cut off somehow.
What's proper way to fix it?
#!/usr/bin/env python3
import pandas as pd
import re
import datetime
import os
import plotly.graph_objects as go
import numpy as np
import math
import datetime
def save_fig(fig,pngname):
fig.write_image(pngname,format="png", width=800, height=400, scale=1)
print("[[%s]]"%pngname)
return
def plot_bars(df,pngname):
colors = ['#5891ad','#004561','#ff6f31','#1c7685','#0f45a8','#4cdc8b','#0097a7']
fig = go.Figure()
traces = []
xname = df.columns[0]
for i,yname in enumerate(df.columns):
if i == 0: continue
trace1 = go.Bar(
name=yname,
x=df[xname],y=df[yname],meta=df.index,
#texttemplate="%{%.1f}",
text=df[yname],
textposition="outside",
textangle=-25,
textfont_color="black",
marker_color=colors[i-1],
hovertemplate='<br>'.join([
'id:%{meta}',
'ts: %{x|%H:%M:%S}',
'val: %{y:.1f}',
]),
)
traces.append(trace1)
fig.add_traces(traces)
#d0 = df[xname][0].replace(minute=0, second=0) - datetime.timedelta(hours=1)
fig.update_layout(
margin=dict(l=10,t=40,r=10,b=40),
plot_bgcolor='#ffffff',#'rgb(12,163,135)',
paper_bgcolor='#ffffff',
title="Boot progress",
xaxis_title="Keypoints",
yaxis_title="Timestamp(secs)",
title_x=0.5,
barmode='group',
bargap=0.05,
bargroupgap=0.0,
legend=dict(x=.02,y=1),
xaxis=dict(
#tick0 = d0,
#dtick=7200000,
tickangle=-25,
#tickmode='array',
#tickvals = xvals,
#ticktext= xtexts,
#tickformat = '%m-%d %H:%M:%S',#datetime format
showline=True,
linecolor='black',
color='black',
linewidth=.5,
ticks='outside',
#mirror=True,
),
yaxis=dict(
dtick=10,
showline=True,
linecolor='black',
color='black',
linewidth=.5,
#tickvals = yvals,
#ticktext= ytexts,
showgrid=True,
gridcolor='#ececec',
gridwidth=.5,
griddash='solid',#'dot',
zeroline=True,
zerolinecolor='grey',
zerolinewidth=.5,
showticklabels=True,
#mirror=True,
),
)
anns = []
#anns = add_line(fig,anns,x0,y0,x1,y1,text=None)
#add_anns(fig,anns)
save_fig(fig,pngname)
return
def main():
data = [
["A",10,12],
["B",12,11],
["C",14,13],
["D",16,15],
["E",18,19]
]
df = pd.DataFrame(data,columns=["Kepoint","g1","g2"])
plot_bars(df,"demo.png")
return
main()
output png:

Although you could hardcode the range of the y-axes to have a larger maximum value, it's better to use a more flexible solution. Plotly's default behavior is to set the y-range by calculating [y_min-padding, y_max+padding] where the padding = (y_max-y_min)/16.
So we can include a padding multipler to make the padding a bit larger, and specify the new range by passing the argument range=[y_min-y_padding, y_max+y_padding] to yaxis:
def plot_bars(df,pngname):
colors = ['#5891ad','#004561','#ff6f31','#1c7685','#0f45a8','#4cdc8b','#0097a7']
fig = go.Figure()
traces = []
xname = df.columns[0]
for i,yname in enumerate(df.columns):
if i == 0: continue
trace1 = go.Bar(
name=yname,
x=df[xname],y=df[yname],meta=df.index,
#texttemplate="%{%.1f}",
text=df[yname],
textposition="outside",
textangle=-25,
textfont_color="black",
marker_color=colors[i-1],
hovertemplate='<br>'.join([
'id:%{meta}',
'ts: %{x|%H:%M:%S}',
'val: %{y:.1f}',
]),
)
traces.append(trace1)
fig.add_traces(traces)
#d0 = df[xname][0].replace(minute=0, second=0) - datetime.timedelta(hours=1)
y_min = df[["g1","g2"]].min().min()
y_max = df[["g1","g2"]].max().max()
padding_multiplier = 1.25
y_padding = padding_multiplier*(y_max-y_min)/16
fig.update_layout(
margin=dict(l=10,t=40,r=10,b=40),
plot_bgcolor='#ffffff',#'rgb(12,163,135)',
paper_bgcolor='#ffffff',
title="Boot progress",
xaxis_title="Keypoints",
yaxis_title="Timestamp(secs)",
title_x=0.5,
barmode='group',
bargap=0.05,
bargroupgap=0.0,
legend=dict(x=.02,y=1),
xaxis=dict(
#tick0 = d0,
#dtick=7200000,
tickangle=-25,
#tickmode='array',
#tickvals = xvals,
#ticktext= xtexts,
#tickformat = '%m-%d %H:%M:%S',#datetime format
showline=True,
linecolor='black',
color='black',
linewidth=.5,
ticks='outside',
#mirror=True,
),
yaxis=dict(
dtick=10,
range=[y_min-y_padding, y_max+y_padding],
showline=True,
linecolor='black',
color='black',
linewidth=.5,
#tickvals = yvals,
#ticktext= ytexts,
showgrid=True,
gridcolor='#ececec',
gridwidth=.5,
griddash='solid',#'dot',
zeroline=True,
zerolinecolor='grey',
zerolinewidth=.5,
showticklabels=True,
#mirror=True,
),
)
anns = []
#anns = add_line(fig,anns,x0,y0,x1,y1,text=None)
#add_anns(fig,anns)
save_fig(fig,pngname)
return

Related

Plotly Python update figure with dropMenu

i am currently working with plotly i have a function called plotChart that takes a dataframe as input and plots a candlestick chart. I am trying to figure out a way to pass a list of dataframes to the function plotChart and use a plotly dropdown menu to show the options on the input list by the stock name. The drop down menu will have the list of dataframe and when an option is clicked on it will update the figure in plotly is there away to do this. below is the code i have to plot a single dataframe
def make_multi_plot(df):
fig = make_subplots(rows=2, cols=2,
shared_xaxes=True,
vertical_spacing=0.03,
subplot_titles=('OHLC', 'Volume Profile'),
row_width=[0.2, 0.7])
for s in df.name.unique():
trace1 = go.Candlestick(
x=df.loc[df.name.isin([s])].time,
open=df.loc[df.name.isin([s])].open,
high=df.loc[df.name.isin([s])].high,
low=df.loc[df.name.isin([s])].low,
close=df.loc[df.name.isin([s])].close,
name = s)
fig.append_trace(trace1,1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].BbandsMid, mode='lines',name='MidBollinger'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].BbandsUpp, mode='lines',name='UpperBollinger'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].BbandsLow, mode='lines',name='LowerBollinger'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].vwap, mode='lines',name='VWAP'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].STDEV_1, mode='lines',name='UPPERVWAP'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].STDEV_N1, mode='lines',name='LOWERVWAP'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].KcMid, mode='lines',name='KcMid'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].KcUpper, mode='lines',name='KcUpper'),1,1)
fig.append_trace(go.Scatter(x=df.loc[df.name.isin([s])].time, y=df.loc[df.name.isin([s])].KcLow, mode='lines',name='KcLow'),1,1)
trace2 = go.Bar(
x=df.loc[df.name.isin([s])].time,
y=df.loc[df.name.isin([s])].volume,
name = s)
fig.append_trace(trace2,2,1)
# fig.update_layout(title_text=s)
graph_cnt=len(fig.data)
tr = 11
symbol_cnt =len(df.name.unique())
for g in range(tr, graph_cnt):
fig.update_traces(visible=False, selector=g)
#print(g)
def create_layout_button(k, symbol):
start, end = tr*k, tr*k+2
visibility = [False]*tr*symbol_cnt
visibility[start:end] = [True,True,True,True,True,True,True,True,True,True,True]
return dict(label = symbol,
method = 'restyle',
args = [{'visible': visibility[:-1],
'title': symbol,
'showlegend': False}])
fig.update(layout_xaxis_rangeslider_visible=False)
fig.update_layout(
updatemenus=[go.layout.Updatemenu(
active = 0,
buttons = [create_layout_button(k, s) for k, s in enumerate(df.name.unique())]
)
])
fig.show()
i am trying to add annotations to the figure it will be different for each chart below is how i had it setup for the single chart df['superTrend'] is a Boolean column
for i in range(df.first_valid_index()+1,len(df.index)):
prev = i - 1
if df['superTrend'][i] != df['superTrend'][prev] and not np.isnan(df['superTrend'][i]) :
#print(i,df['inUptrend'][i])
fig.add_annotation(x=df['time'][i], y=df['open'][i],
text= 'Buy' if df['superTrend'][i] else 'Sell',
showarrow=True,
arrowhead=6,
font=dict(
#family="Courier New, monospace",
size=20,
#color="#ffffff"
),)
I adapted an example from the plotly community to your example and created the code. The point of creation is to create the data for each subplot and then switch between them by means of buttons. The sample data is created using representative companies of US stocks. one issue is that the title is set but not displayed. We are currently investigating this issue.
import yfinance as yf
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pandas as pd
symbols = ['AAPL','GOOG','TSLA']
stocks = pd.DataFrame()
for s in symbols:
data = yf.download(s, start="2021-01-01", end="2021-12-31")
data['mean'] = data['Close'].rolling(20).mean()
data['std'] = data['Close'].rolling(20).std()
data['upperBand'] = data['mean'] + (data['std'] * 2)
data.reset_index(inplace=True)
data['symbol'] = s
stocks = stocks.append(data, ignore_index=True)
def make_multi_plot(df):
fig = make_subplots(rows=2, cols=1,
shared_xaxes=True,
vertical_spacing=0.03,
subplot_titles=('OHLC', 'Volume Profile'),
row_width=[0.2, 0.7])
for s in df.symbol.unique():
trace1 = go.Candlestick(
x=df.loc[df.symbol.isin([s])].Date,
open=df.loc[df.symbol.isin([s])].Open,
high=df.loc[df.symbol.isin([s])].High,
low=df.loc[df.symbol.isin([s])].Low,
close=df.loc[df.symbol.isin([s])].Close,
name=s)
fig.append_trace(trace1,1,1)
trace2 = go.Scatter(
x=df.loc[df.symbol.isin([s])].Date,
y=df.loc[df.symbol.isin([s])].upperBand,
name=s)
fig.append_trace(trace2,1,1)
trace3 = go.Bar(
x=df.loc[df.symbol.isin([s])].Date,
y=df.loc[df.symbol.isin([s])].Volume,
name=s)
fig.append_trace(trace3,2,1)
# fig.update_layout(title_text=s)
# Calculate the total number of graphs
graph_cnt=len(fig.data)
# Number of Symbols
symbol_cnt =len(df.symbol.unique())
# Number of graphs per symbol
tr = 3
# Hide setting for initial display
for g in range(tr, graph_cnt):
fig.update_traces(visible=False, selector=g)
def create_layout_button(k, symbol):
start, end = tr*k, tr*k+2
visibility = [False]*tr*symbol_cnt
# Number of graphs per symbol, so if you add a graph, add True.
visibility[start:end] = [True,True,True]
return dict(label = symbol,
method = 'restyle',
args = [{'visible': visibility[:-1],
'title': symbol,
'showlegend': True}])
fig.update(layout_xaxis_rangeslider_visible=False)
fig.update_layout(
updatemenus=[go.layout.Updatemenu(
active = 0,
buttons = [create_layout_button(k, s) for k, s in enumerate(df.symbol.unique())]
)
])
fig.show()
return fig.layout
make_multi_plot(stocks)

Change parameters for plotly maps

I'm trying to plot the intensity of CO2 emissions per country using plotly ,
Most of the countries don't even exceed 10k, but the color range is from 0 to 35k , how do I change that?
Here's my code:
def enable_plotly_in_cell():
import IPython
from plotly.offline import init_notebook_mode
display(IPython.core.display.HTML('''<script src="/static/components/requirejs/require.js"></script>'''))
init_notebook_mode(connected=False)
data = dict(type = 'choropleth',
locations = fmmcgrf['Entity'],
locationmode = 'country names',
z = fmmcgrf['CO2'],
text = fmmcgrf['Entity'],
colorbar = {'title':'CO2'})
layout = dict(title = 'Co2',
geo = dict(showframe = False,
projection = {'type': 'winkel tripel'}))
map = go.Figure(data = [data], layout=layout)
enable_plotly_in_cell()
map.show()
I customized the color bar with the example from the official reference.
import plotly.graph_objects as go
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv')
fig = go.Figure(data=go.Choropleth(
locations = df['CODE'],
z = df['GDP (BILLIONS)'],
text = df['COUNTRY'],
colorscale = 'Blues',
autocolorscale=False,
reversescale=True,
marker_line_color='darkgray',
marker_line_width=0.5,
colorbar_tickprefix = '$',
colorbar_tickvals=[0,10000,15000],# update
colorbar_title = 'GDP<br>Billions US$',
))
fig.update_layout(
title_text='2014 Global GDP',
geo=dict(
showframe=False,
showcoastlines=False,
projection_type='equirectangular'
),
)
fig.show()

Plotly Funnel Chart Example Shows Zero Width Shapes

I have copied and pasted the exact code on the plotly example page here in a Jupyter notebook - with the exception that I am running in offline mode so my import statements look like this:
from plotly.offline import init_notebook_mode
import plotly.offline as py
import plotly.figure_factory as ff
from plotly import graph_objs as go
init_notebook_mode()
The resulting plot has funnel shapes with no width.
Is the example code broken? I thought it had something to do with defining the shape and path variables, but printing those values they look reasonable.
Or, seems unlikely, but could offline mode be messing something up?
Complete code from the linked example is below:
values = [13873, 10553, 5443, 3703, 1708]
phases = ['Visit', 'Sign-up', 'Selection', 'Purchase', 'Review']
colors = ['rgb(32,155,160)', 'rgb(253,93,124)', 'rgb(28,119,139)', 'rgb(182,231,235)', 'rgb(35,154,160)']
n_phase = len(phases)
plot_width = 400
section_h = 100
section_d = 10
unit_width = plot_width / max(values)
phase_w = [int(value * unit_width) for value in values]
height = section_h * n_phase + section_d * (n_phase - 1)
shapes = []
label_y = []
for i in range(n_phase):
if (i == n_phase-1):
points = [phase_w[i] / 2, height, phase_w[i] / 2, height - section_h]
else:
points = [phase_w[i] / 2, height, phase_w[i+1] / 2, height - section_h]
path = 'M {0} {1} L {2} {3} L -{2} {3} L -{0} {1} Z'.format(*points)
shape = {
'type': 'path',
'path': path,
'fillcolor': colors[i],
'line': {
'width': 1,
'color': colors[i]
}
}
shapes.append(shape)
# Y-axis location for this section's details (text)
label_y.append(height - (section_h / 2))
height = height - (section_h + section_d)
# For phase names
label_trace = go.Scatter(
x=[-350]*n_phase,
y=label_y,
mode='text',
text=phases,
textfont=dict(
color='rgb(200,200,200)',
size=15
)
)
# For phase values
value_trace = go.Scatter(
x=[350]*n_phase,
y=label_y,
mode='text',
text=values,
textfont=dict(
color='rgb(200,200,200)',
size=15
)
)
data = [label_trace, value_trace]
layout = go.Layout(
title="<b>Funnel Chart</b>",
titlefont=dict(
size=20,
color='rgb(203,203,203)'
),
shapes=shapes,
height=560,
width=800,
showlegend=False,
paper_bgcolor='rgba(44,58,71,1)',
plot_bgcolor='rgba(44,58,71,1)',
xaxis=dict(
showticklabels=False,
zeroline=False,
),
yaxis=dict(
showticklabels=False,
zeroline=False
)
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig)

Jupyter Notebook not ploting output using plotly

I am working on choropleth using plotly in Jupyter Notebook.I want to plot choropleth but its showing me empty output.I am working with offline plotly.In html its genrated chart successfuly but when i tried offline it shows me empty output.please tell me how i solve this error.
here is my code
from plotly.graph_objs import *
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
from plotly.offline.offline import _plot_html
init_notebook_mode(connected=True)
for col in state_df.columns:
state_df[col] = state_df[col].astype(str)
scl = [[0.0, 'rgb(242,240,247)'],[0.2, 'rgb(218,218,235)'],[0.4, 'rgb(188,189,220)'],\
[0.6, 'rgb(158,154,200)'],[0.8, 'rgb(117,107,177)'],[1.0, 'rgb(84,39,143)']]
state_df['text'] = state_df['StateCode'] + '<br>' +'TotalPlans '+state_df['TotalPlans']
data = [ dict(
type='choropleth',
colorscale = scl,
autocolorscale = False,
locations = state_df['StateCode'],
z = state_df['TotalPlans'].astype(float),
locationmode = 'USA-states',
text = state_df['text'],
marker = dict(
line = dict (
color = 'rgb(255,255,255)',
width = 2
)
),
colorbar = dict(
title = "Millions USD"
)
) ]
layout = dict(
title = 'Plan by States',
geo = dict(
scope='usa',
projection=dict( type='albers usa' ),
showlakes = True,
lakecolor = 'rgb(255, 255, 255)',
),
)
fig = dict(data=data, layout=layout)
plotly.offline.iplot(fig)
You are passing a dictionary to iplot which in contradiction to the documentation can handle only Figure objects and not dictionaries.
Try
fig = Figure(data=[data], layout=layout)
and it should work.

Matplotlib tilted text on log scale?

Either I cannot figure it out, or there is a bug in matplotlib when drawing text() with rotation to loglog or xscale('log'); yscale('log'); plot.
my code looks like this:
from pylab import *
# =================== deltaV-vs-trust
figure( figsize=( 12, 8 ) )
times = array( [ 1.0, 60.0, 3600.0, 86400.0, 604800, 2592000, 31556926, 315569260, 3155692600 ] )
timeText = [ 'sec','min','hour', 'day', 'week', 'month', 'year', '10years', '100years' ]
dists = array( [ 1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 6371e+3, 42164e+3, 384400e+3, 1e+9, 1e+10, 5.790918E+010, 1.082089E+011, 1.495979E+011, 2.279366E+011, 7.784120E+011, 1.426725E+012, 2.870972E+012, 4.498253E+012, 1.40621998e+13, 2.99195741e+14, 7.47989354e+15, 4.13425091e+16 ] )
distText = [ '10m','100m', '1km','10km', '100km', '1000km', 'LEO', 'GEO', 'Moon', r'10$^6$km',r'10$^7$km', 'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Satrun', 'Uranus', 'Neptune', 'Heliopause', 'Inner Oorth', 'Outer Oorth', 'Alpha Centauri' ]
vMin = 1e+0; vMax = 1e+8;
aMin = 1e-4; aMax = 1e+2;
As = linspace(aMin,aMax,2); print As
Vs = linspace(vMin,vMax,2); print Vs
As_ = As.copy(); Vs_ = Vs.copy()
for i in range(len(dists)):
dist = dists[i]
ts = sqrt( 2*dist / As )
As_[:] = As [:]
Vs_ = As * ts
if( Vs_[0] < Vs[0] ):
Vs_[0] = Vs[0]
As_[0] = Vs_[0]**2 / (2*dist)
plot( Vs_, As_, 'b-', alpha=0.5 )
plt.text( Vs_[0], As_[0], distText[i], rotation=60, color='b', horizontalalignment='center', verticalalignment='bottom') # this does not work properly
#plt.text( Vs_[0], As_[0], distText[i], rotation=60, color='b', horizontalalignment='center', verticalalignment='center') # this works but does not look nice
#plt.text( Vs_[0], 1.5*As_[0], distText[i], rotation=60, color='b', horizontalalignment='center', verticalalignment='center') # a bit better
for i in range(len(times)):
time = times[i]
As_[:] = As[:]
Vs_ = As * time
if( Vs_[1] > Vs[1] ):
Vs_[1] = Vs[1]
As_[1] = Vs_[1] / time
plot( Vs_, As_, 'r-', alpha=0.5 )
plt.text( Vs_[1], As_[1], timeText[i]+" ", rotation=40, color='r', horizontalalignment='right', verticalalignment='baseline')
ylabel( r" acceleration [m/s$^2$] " )
xlabel( r" delta-v [m/s ] " )
yscale('log')
xscale('log')
grid()
ylim( aMin, aMax )
xlim( vMin, vMax )
show()
the result looks like this ( you can see how text is not possitioned correctly on the corresponding line; very visible for Inner Oorth,Outer Oorth and Alpha Centauri ) :
I think this problem is visible only for large rotation angles. If I use horizontalalignment='center', verticalalignment='center' it works properly, however it does not looks nice ( because the line cross the text and the text cross the border of image )
just for context - what I'm trying to make is plot like this:
http://www.projectrho.com/public_html/rocket/images/enginelist/torchChart.jpg
The key is the 'rotation_mode' kwarg to text (doc) which I did not even know existed until tonight. What this controls is if the text is rotated, then aligned (the default) or aligned, then rotated.
In trying to understand your question I cleaned your code up to (more or less) conform to pep8 and simplified some of the computation.
import matplotlib.pyplot as plt
import numpy as np
# =================== deltaV-vs-trust
times = np.array([1.0, 60.0, 3600.0, 86400.0, 604800, 2592000, 31556926, 315569260, 3155692600])
timeText = ['sec','min','hour', 'day', 'week', 'month', 'year', '10years', '100years']
dists= np.array([1e+1, 1e+2, 1e+3, 1e+4, 1e+5, 1e+6, 6371e+3, 42164e+3,
384400e+3, 1e+9, 1e+10, 5.790918E+010, 1.082089E+011, 1.495979E+011,
2.279366E+011, 7.784120E+011, 1.426725E+012, 2.870972E+012,
4.498253E+012, 1.40621998e+13, 2.99195741e+14, 7.47989354e+15,
4.13425091e+16])
distText = ['10m','100m', '1km','10km', '100km', '1000km', 'LEO',
'GEO', 'Moon', r'10$^6$km',r'10$^7$km', 'Mercury', 'Venus', 'Earth',
'Mars', 'Jupiter', 'Satrun', 'Uranus', 'Neptune', 'Heliopause',
'Oorth', 'Outer Oorth', 'Alpha Centauri']
vMin, vMax = 1e+0, 1e+8
aMin, aMax = 1e-4, 1e+2
As = np.linspace(aMin, aMax, 2)
fig, ax = plt.subplots(figsize=(12, 8))
for dist, text in zip(dists, distText):
# compute the line
v = np.sqrt(2*dist * As)
ax.plot(v, As, 'b-', alpha=0.5)
# sort out where the label should be
txt_y = aMin
txt_x = v[0]
# clip to the edges
if (txt_x < vMin):
txt_x = vMin
txt_y = vMin**2 / (2*dist)
ax.text(txt_x, txt_y, text,
rotation=60, color='b', rotation_mode='anchor',
horizontalalignment='left',
verticalalignment='bottom')
for time, txt in zip(times, timeText):
# compute the line
x = As * time
ax.plot(x, As, 'r-', alpha=0.5)
# sort out where the label should be
txt_x = x[-1]
txt_y = aMax
# clip to the edges
if(txt_x > vMax):
txt_x = vMax
txt_y = vMax / time
ax.text(txt_x, txt_y, txt,
rotation=40, color='r',
horizontalalignment='right', rotation_mode='anchor',
verticalalignment='baseline')
ax.set_ylabel(r"acceleration [m/s$^2$]")
ax.set_xlabel(r"delta-v [m/s]")
ax.set_yscale('log')
ax.set_xscale('log')
ax.grid()
ax.set_ylim(aMin, aMax)
ax.set_xlim(vMin, vMax)

Categories

Resources