3

Say I want to display a small one row dataframe on a plot, is this possible?

Example:

    buy_hold    coin    lose.max    no_trades   strat_prof  win.max
0   7.406522    DASH    -2.115741   89.0    270.080641  123.46243

I want the resulting plot to look like this: plot

6
  • Is this MATLAB related? Also, how do you want to display it? It is possible, in infinite different ways. What do you want the plot to look like? Commented Feb 2, 2017 at 8:34
  • Sorry I should have been more specific, like this i.imgur.com/dRJM9YI.png Commented Feb 2, 2017 at 8:45
  • also bonus question do you know why the colors don't change you change the rgbp tuple on 'double y axis example' ? plot.ly/python/multiple-axes Commented Feb 2, 2017 at 8:47
  • 1
    That's why I said 'display' not 'plot' in the title Commented Feb 2, 2017 at 8:47
  • 1
    @IlyaV.Schurov Its not the plot, but the table below the plot what OP wants Commented Feb 2, 2017 at 13:14

1 Answer 1

1

EDIT: I first suggested using Pandas to plot the table, but it can also be done directly with Matplotlib.

Matplotlib has a method for displaying tables in plots, and it can be customized in many ways, see the documentation here.

Here is a plot that looks quite similar to what you want:

enter image description here

The code for the plot:

import numpy as np
import matplotlib.pyplot as plt

plot([1, 3], [40, 60])
plot([2, 4], [40, 60])
ylim(37, 60)

columns = ["buy_hold", "coin", "lose.max", "no_trades", "strat_prof", "win.max"]
cell_text = [["7.406522", "DASH", "-2.115741", "89.0", "270.080641", "123.46243"]]

# Add a table at the bottom of the axes
the_table = plt.table(cellText=cell_text,
                      colLabels=columns,
                      colWidths=[.15]*len(columns),
                      loc='lower right')

# Adjust layout to make room for the table:
#plt.subplots_adjust(bottom=0.3)

plt.show()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.