0

I've found that various packages don't allow for use of plt.figure(figsize=(12,10)) and set default values figure size on very low level. I met this problem for example in pyalgotrade module:

So the question it how to increase chart size in more universal way in Jupyter and specifically in pyalgotrade plotter ?

Default chart size in pyalgotrade is very small:

from pyalgotrade import plotter
from pyalgotrade.barfeed import quandlfeed
from pyalgotrade.stratanalyzer import returns
import sma_crossover

# Load the bar feed from the CSV file
feed = quandlfeed.Feed()
feed.addBarsFromCSV("orcl", "WIKI-ORCL-2000-quandl.csv")

# Evaluate the strategy with the feed's bars.
myStrategy = sma_crossover.SMACrossOver(feed, "orcl", 20)

# Attach a returns analyzers to the strategy.
returnsAnalyzer = returns.Returns()
myStrategy.attachAnalyzer(returnsAnalyzer)

# Attach the plotter to the strategy.
plt = plotter.StrategyPlotter(myStrategy)
# Include the SMA in the instrument's subplot to get it displayed along with the closing prices.
plt.getInstrumentSubplot("orcl").addDataSeries("SMA", myStrategy.getSMA())
# Plot the simple returns on each bar.
plt.getOrCreateSubplot("returns").addDataSeries("Simple returns", returnsAnalyzer.getReturns())

# Run the strategy.
myStrategy.run()
myStrategy.info("Final portfolio value: $%.2f" % myStrategy.getResult())

# Plot the strategy.
plt.plot()

pyalgotrade tutorial

Qbik
  • 5,885
  • 14
  • 62
  • 93
  • 2
    you could try increasing the `figure.dpi` setting in your [`matplotlibrc`](https://matplotlib.org/stable/tutorials/introductory/customizing.html) file, since that also affects the size of figures displayed in a Jupiter notebook – tmdavison May 20 '21 at 10:18
  • `plt.rcParams['figure.figsize'] = (16.0, 10.0)` – Trenton McKinney May 20 '21 at 18:31

0 Answers0