Skip to content

Instantly share code, notes, and snippets.

@mihkell
Last active February 20, 2017 12:39
Show Gist options
  • Save mihkell/408ccbeae8da0ee7366e22a2ece93c41 to your computer and use it in GitHub Desktop.
Save mihkell/408ccbeae8da0ee7366e22a2ece93c41 to your computer and use it in GitHub Desktop.
Example of diagonal swap of graph
import pandas as pd
import matplotlib.pyplot as plt
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 100000)
price = 'Price'
quantity = 'Quantity'
def make_table():
global price, quantity
table = pd.DataFrame({price:[1,3,3,2,5,6], quantity:[1,2,3,4,5,6]})
table[quantity] = table[quantity] * 100
return table
my_tabel = make_table()
their_tabel = make_table()
their_tabel = their_tabel *2
plt.plot(
my_tabel, my_tabel[price], 'g--',
their_tabel, their_tabel[price], 'r--'
)
max_quant = 13000
min_quant = 50
max_pri = 6
min_pri = 0
plt.axis([min_quant, max_quant, min_pri, max_pri])
plt.ylabel(quantity)
plt.xlabel(price)
plt.show()
plt.plot(
my_tabel, my_tabel[quantity], 'g--',
their_tabel, their_tabel[quantity], 'r--'
)
plt.axis([ min_pri, max_pri, min_quant, max_quant])
plt.ylabel(price)
plt.xlabel(quantity)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment