Skip to content

Commit

Permalink
fixing abslope. more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
glamp committed May 2, 2016
1 parent 0dae798 commit 76cfe65
Show file tree
Hide file tree
Showing 100 changed files with 114 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
*.swp
*.DS_Store
109 changes: 80 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,83 @@

### Examples

![](./examples/example-019ca7b7-79b0-4b24-9b8a-1cd6f77ed963.png)
![](./examples/example-03de7ffc-3470-401e-b3a4-a2ca4001efdd.png)
![](./examples/example-0532d318-bc52-411a-a7e8-5818a76493df.png)
![](./examples/example-06e58ec1-045a-4209-a707-42d2ee742e38.png)
![](./examples/example-0b151d34-059e-47af-b357-07c3bc1f12b2.png)
![](./examples/example-14f88c0f-7b1f-4877-85aa-458c0d63ca39.png)
![](./examples/example-15721b26-8192-45e6-b67f-477881537211.png)
![](./examples/example-25916c58-37ac-4e20-8908-3a90cb44b96f.png)
![](./examples/example-26018d84-a491-40ac-932f-8f0f08ebc636.png)
![](./examples/example-2a587fa1-2f19-497d-b776-af9c6023dacf.png)
![](./examples/example-353200ae-4b25-46fd-8f25-ba18792c4964.png)
![](./examples/example-39d4578b-34e2-4e9b-a32d-2345aebee3ac.png)
![](./examples/example-438d917f-9dce-471d-a89a-463be738f7a5.png)
![](./examples/example-504a41fb-48fb-4825-bbaa-fe9bf06740fa.png)
![](./examples/example-6df31c8b-cd67-41ea-a499-fa8fc23b23ff.png)
![](./examples/example-7d221f73-116f-46a7-bafc-3db22c4f9dec.png)
![](./examples/example-7e788297-d4a6-4d62-81dc-1db2f26ad572.png)
![](./examples/example-8b6d325a-9bec-4235-b93f-fe7698ee6f15.png)
![](./examples/example-994a9ec0-970d-49d5-8777-5c147b21d629.png)
![](./examples/example-bd94040a-e316-42e5-8bfc-6a40ef465afc.png)
![](./examples/example-cf624904-4bed-4c3b-a6ca-9945266a491f.png)
![](./examples/example-d160777c-29c3-440a-97bc-a2e75dee5897.png)
![](./examples/example-d5140245-307a-4b33-a80b-a70ea66d630c.png)
![](./examples/example-d5818df6-b25b-4b38-b8f6-bd497ad5e228.png)
![](./examples/example-d6c107cc-f277-4e4f-93a1-b671e6be4f22.png)
![](./examples/example-e2a1e2f1-701b-4226-944e-af13afea81cc.png)
![](./examples/example-e62f6008-fd32-4788-a0c1-1bd56a0b6407.png)
![](./examples/example-ee7cd95a-9812-4437-ade7-736d881102f0.png)
![](./examples/example-fe2fb96c-3787-4afc-a502-27400087d386.png)
![](./examples/example-01ab6e56-bc32-455e-9842-45262fd341ad.png)
![](./examples/example-02687ac6-7e68-4b28-9811-4ef487b20ba4.png)
![](./examples/example-0514c0ae-944a-40e6-80cb-c037bc6a619d.png)
![](./examples/example-0c9b8b58-fae4-447d-a78b-7913194cb1c8.png)
![](./examples/example-0e43ff98-aefd-44e4-9e30-02c9ccf13e90.png)
![](./examples/example-17bc1730-b20e-4d0c-a0ca-e40b517e82a3.png)
![](./examples/example-1c3fbee1-1745-4570-9a00-56efba3085c4.png)
![](./examples/example-1fbb7ef1-d295-464c-9234-38b54bb61e3d.png)
![](./examples/example-20ab89e2-7ab6-417d-bba7-148fb92a8e30.png)
![](./examples/example-20c9a55c-a526-4e85-af6b-8df86f466048.png)
![](./examples/example-21469f96-98ce-4ca1-b1df-2306308f8e4b.png)
![](./examples/example-21dedf76-0d4e-4074-b169-be7303e71dc1.png)
![](./examples/example-2217f545-17d4-44b6-8a2f-1361ea310c10.png)
![](./examples/example-2305e12b-23aa-4f41-bcd3-17d8a971eec8.png)
![](./examples/example-2d2ad075-79fe-4fff-bda0-b520b5804e8d.png)
![](./examples/example-311c7460-034d-48fc-ae71-d041c97663ef.png)
![](./examples/example-3325f55f-fb4b-4a29-a105-8fa5cc3e6140.png)
![](./examples/example-33cc1744-b9a7-4e2f-839a-73cc17dd11c3.png)
![](./examples/example-34691ced-fae4-44a5-9f4e-cc33232143b3.png)
![](./examples/example-34d773b9-ec68-40b1-999b-7bb07c208be9.png)
![](./examples/example-3708e145-8f1b-485e-8c30-3241861c9177.png)
![](./examples/example-44a1d142-63dc-4e73-9116-0b3c44ff9f33.png)
![](./examples/example-48d8985c-a028-49c4-8c4b-b7d0dd335293.png)
![](./examples/example-4a07a92f-f60c-4200-ba95-3e74dade461b.png)
![](./examples/example-4b291adb-5c6b-4a59-b494-43123aa39d3e.png)
![](./examples/example-4d23081c-e280-4664-b53d-a0f2e99f8479.png)
![](./examples/example-4e6211d3-7d99-49ef-9c1a-d00887add29b.png)
![](./examples/example-52ec20bb-446b-481e-a863-c65e40901446.png)
![](./examples/example-55b23c7f-b847-446d-80ff-0d613781190e.png)
![](./examples/example-5873a00c-ff47-4ab1-abe3-df8cc498c773.png)
![](./examples/example-58c02486-17c6-48f2-b435-acf8da63d12d.png)
![](./examples/example-5a7cbe1b-49ac-48a0-b3bc-15c2ad9183c5.png)
![](./examples/example-5b540976-f321-43fa-bcc4-4d147031bc1a.png)
![](./examples/example-5dddf73e-92e0-409d-9a95-f863b2c33d82.png)
![](./examples/example-5f144c4e-33f3-44b5-b418-eaff8ada2054.png)
![](./examples/example-648372f0-df2e-49e4-a5ef-cb0e1b0a1933.png)
![](./examples/example-64b7425d-136f-48bd-a044-3e8cf869eea9.png)
![](./examples/example-6fc05099-0330-4151-bc2c-0f18a28f7730.png)
![](./examples/example-718416d1-895b-4883-8a30-ded4525e1719.png)
![](./examples/example-7659cb36-63c9-4760-90e4-eece63890a67.png)
![](./examples/example-76b48b01-1b41-4bf9-9880-a98acee7113c.png)
![](./examples/example-811d20c0-2e38-4f59-979a-eb86e0b28e96.png)
![](./examples/example-8f4fbffe-2999-42b0-9c34-de6f0b205733.png)
![](./examples/example-8fccad7a-020c-4018-b7b1-569d73bdec89.png)
![](./examples/example-904401f7-bc70-44f2-9440-845326905ed8.png)
![](./examples/example-91784097-6377-4302-b9e1-b6735a01a235.png)
![](./examples/example-96057f1a-6090-41f7-8d1a-129d6fdb78be.png)
![](./examples/example-a0610ead-f774-4be3-a876-431442e086b6.png)
![](./examples/example-a1e27e56-60f3-4d1e-9024-6b11e177a33c.png)
![](./examples/example-a2af229a-ee7d-49a0-b163-a1e129570096.png)
![](./examples/example-a3c87a12-0d9b-4747-8c2c-0ff6fe3e3cc5.png)
![](./examples/example-a42c09e5-9977-4dbf-a9f6-32a1ced8b1d5.png)
![](./examples/example-a5d47561-773c-49f8-b76a-91beaf1ecbb2.png)
![](./examples/example-a7cf1dd8-104e-419c-90c7-ec0e5a5d10d7.png)
![](./examples/example-a864af7f-458c-4017-b8c2-298d43afce77.png)
![](./examples/example-aa977288-9cca-45d1-b743-c6e49b814cd7.png)
![](./examples/example-ac1e1301-535f-4e59-91fa-d4c20d4fd23d.png)
![](./examples/example-ad142339-1827-465e-86b0-478bcb5edbd4.png)
![](./examples/example-b03399cc-ce45-44a9-b701-23f91c57a6cf.png)
![](./examples/example-b2ed9041-ba23-470c-b10a-a461e6c0fa79.png)
![](./examples/example-b4119243-8530-4429-9e93-ced574b2ce05.png)
![](./examples/example-b86fdc16-ecb3-4b6a-b22e-386af6601b15.png)
![](./examples/example-be8292ab-13dd-4192-8c0e-5ecb95e90cf6.png)
![](./examples/example-c1ea42e5-435b-4e5e-9f2c-95bbe85e25d5.png)
![](./examples/example-c5500838-014d-4fe3-809b-314cbf214d98.png)
![](./examples/example-c600700b-d3b1-4fea-82cc-cd9d3582c93b.png)
![](./examples/example-c6f0adff-ae6c-4c71-976e-a893be58c81f.png)
![](./examples/example-c7c0a380-f50b-413a-beeb-b006e5740363.png)
![](./examples/example-c9358e27-5145-447d-b31d-5ce6126cb1c1.png)
![](./examples/example-c9c55564-02d9-4e5d-ba24-0ff411944aec.png)
![](./examples/example-cd2bd612-e802-4910-924a-b7d77d3b9735.png)
![](./examples/example-cd64f522-058b-49f0-a535-8401016fcfd4.png)
![](./examples/example-d44c50b7-4cd5-4cd1-b901-e28dd4e25686.png)
![](./examples/example-d951516d-6083-4b4f-b882-913f7024e9c5.png)
![](./examples/example-dd48ccf1-f982-4fa5-9f92-065dcc44372e.png)
![](./examples/example-dddae5d3-9714-4dd5-9c01-e674eafe18de.png)
![](./examples/example-e38514e1-2aaa-4893-ba56-62b767649a74.png)
![](./examples/example-ee62897e-f7c4-49c4-825e-9d8176fa32ed.png)
![](./examples/example-f8aa92cf-1910-4c40-b11f-bb8079d4ccd8.png)
![](./examples/example-fe1a8632-640a-470d-9a9a-1bdc3477fca3.png)
4 changes: 2 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ TODO
- [x] size
- [?] xmin, xmax
- [x] ymin, ymax
- [x] slope
- [x] intercept
- [ ] slope
- [ ] intercept
- [x] non-core aes for geoms
- [x] date scales
- [x] facet_wrap bug
Expand Down
36 changes: 18 additions & 18 deletions examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
# # abline
# p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500)
# p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
# # abline w/ facet
# p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500) + facet_wrap(y='clarity')
# p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500)
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")

# # area
# df = pd.DataFrame({"x": np.arange(1000)})
# df['y_low'] = df.x * 0.9
# df['y_high'] = df.x * 1.1
# df['thing'] = ['a' if i%2==0 else 'b' for i in df.x]
# p = ggplot(df, aes(x='x', ymin='y_low', ymax='y_high')) + geom_area()
# abline w/ facet
p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500) + facet_wrap(y='clarity')
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")

# area
df = pd.DataFrame({"x": np.arange(1000)})
df['y_low'] = df.x * 0.9
df['y_high'] = df.x * 1.1
df['thing'] = ['a' if i%2==0 else 'b' for i in df.x]
p = ggplot(df, aes(x='x', ymin='y_low', ymax='y_high')) + geom_area()
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
# # area w/ facet
p = ggplot(df, aes(x='x', ymin='y_low', ymax='y_high')) + geom_area() + facet_wrap(x='thing')
Expand All @@ -130,9 +130,9 @@
p = ggplot(diamonds, aes(x='price')) + geom_histogram() + facet_grid(x='color', y='cut')
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
# df = pd.DataFrame({"x": np.arange(100)})
# df['y'] = df.x * 10
# df['z'] = ["a" if x%2==0 else "b" for x in df.x]
df = pd.DataFrame({"x": np.arange(100)})
df['y'] = df.x * 10
df['z'] = ["a" if x%2==0 else "b" for x in df.x]
#
# # polar coords
p = ggplot(df, aes(x='x', y='y')) + geom_point() + coord_polar()
Expand All @@ -159,8 +159,8 @@
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
# # # x dates formatting faceted
# pageviews['z'] = ["a" if i%2==0 else "b" for i in range(len(pageviews))]
# p = ggplot(pageviews, aes(x='date_hour', y='pageviews')) + geom_line() + scale_x_date(labels=date_format('%B %-d, %Y')) + facet_grid(y='z')
pageviews['z'] = ["a" if i%2==0 else "b" for i in range(len(pageviews))]
p = ggplot(pageviews, aes(x='date_hour', y='pageviews')) + geom_line() + scale_x_date(labels=date_format('%B %-d, %Y')) + facet_grid(y='z')
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
# # geom_line
Expand Down Expand Up @@ -190,7 +190,7 @@
p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + facet_wrap(y='color')
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
# p = ggplot(tips, aes(x='total_bill', y='tip', color='sex')) + geom_point()
p = ggplot(tips, aes(x='total_bill', y='tip', color='sex')) + geom_point()
p + scale_color_brewer(type='div')
p.save("./examples/example-" + str(uuid.uuid4()) + ".png")
#
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
4 changes: 2 additions & 2 deletions ggplot/geoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ def plot(self, ax, data, _aes):

class geom_abline(geom):

"intercept, slope"

DEFAULT_AES = {'color': 'black', 'linetype': 'solid',
'alpha': None, 'size': 1.0, 'x': None,
'y': None}
Expand All @@ -191,6 +189,8 @@ def plot(self, ax, data, _aes):
# don't need the original params from the aesthetics
del params['x']
del params['y']
del params['slope']
del params['intercept']
ax.plot(x, y, **params)


Expand Down
22 changes: 11 additions & 11 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import sys


p = ggplot(mtcars, aes(x='mpg', y='cyl', color='steelblue')) + geom_point()
print p
p = ggplot(mtcars, aes(x='mpg', y='cyl')) + geom_point(color='green')
print p
# p = ggplot(mtcars, aes(x='mpg', y='cyl', color='steelblue')) + geom_point()
# print p
# p = ggplot(mtcars, aes(x='mpg', y='cyl')) + geom_point(color='green')
# print p
# p = ggplot(diamonds.sample(100), aes(x='carat', y='price')) + geom_point() + facet_wrap('clarity', ncol=4)
# print p
# p = ggplot(diamonds.sample(100), aes(x='carat', y='price')) + geom_point() + facet_wrap('clarity', nrow=5)
Expand Down Expand Up @@ -94,13 +94,13 @@
# p = ggplot(diamonds, aes(x='clarity', weight='x')) + geom_bar()
# print """p = ggplot(diamonds, aes(x='clarity', weight='x')) + geom_bar()""", p
#
# # abline
# p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500)
# print """p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500)""", p
#
# # abline w/ facet
# p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500) + facet_wrap(y='clarity')
# print """p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500) + facet_wrap(y='clarity')""", p
# abline
p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500)
print """p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500)""", p

# abline w/ facet
p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500) + facet_wrap(y='clarity')
print """p = ggplot(diamonds, aes(x='carat', y='price')) + geom_point() + geom_abline(slope=5000, intercept=-500) + facet_wrap(y='clarity')""", p

# # area
# df = pd.DataFrame({"x": np.arange(1000)})
Expand Down

0 comments on commit 76cfe65

Please sign in to comment.