Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import plotly.plotly as py
- from plotly.graph_objs import *
- py.sign_in('username', 'api_key')
- trace1 = {
- "x": ["1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003"],
- "y": ["5194", "7786", "10769", "8391", "9581", "10829", "21784", "26606", "29777", "30024", "38881", "51014", "54871", "84600", "96726", "98666", "131391", "146131", "155608", "177500", "207394", "201819", "230511", "243795", "254711", "254463", "260216", "282013", "286803", "540713", "345438", "319317", "313023", "317317", "323486", "340923", "355177", "359841", "377076", "420709", "448915", "489834", "529790", "545382", "594646", "646046", "646037", "674843", "729620", "727668", "731697", "689616", "647456", "584550", "435045", "308206", "171275", "131196", "100193", "75861", "44230", "22389", "5724", "2"],
- "hoverinfo": "y+text",
- "marker": {
- "color": ["5194", "7786", "10769", "8391", "9581", "10829", "21784", "26606", "29777", "30024", "38881", "51014", "54871", "84600", "96726", "98666", "131391", "146131", "155608", "177500", "207394", "201819", "230511", "243795", "254711", "254463", "260216", "282013", "286803", "540713", "345438", "319317", "313023", "317317", "323486", "340923", "355177", "359841", "377076", "420709", "448915", "489834", "529790", "545382", "594646", "646046", "646037", "674843", "729620", "727668", "731697", "689616", "647456", "584550", "435045", "308206", "171275", "131196", "100193", "75861", "44230", "22389", "5724", "2"],
- "colorscale": [
- [0, "#0d0887"], [0.1111111111111111, "#46039f"], [0.2222222222222222, "#7201a8"], [0.3333333333333333, "#9c179e"], [0.4444444444444444, "#bd3786"], [0.5555555555555556, "#d8576b"], [0.6666666666666666, "#ed7953"], [0.7777777777777778, "#fb9f3a"], [0.8888888888888888, "#fdca26"], [1, "#f0f921],
- "colorsrc": ""
- },
- "orientation": "v",
- "text": ["1940", "1941", "1942", "1943", "1944", "1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003"],
- "textsrc": "",
- "type": "bar",
- "xsrc": "",
- "ysrc": ""
- }
- data = Data([trace1])
- layout = {
- "autosize": True,
- "font": {"family": "Arial"},
- "plot_bgcolor": "rgb(170, 176, 179)",
- "title": {"text": "<b>Subscribers by Year of Birth</b>"},
- "xaxis": {
- "autorange": True,
- "range": [1939.5, 2003.5],
- "title": {"text": "<b>Year of Birth</b>"},
- "type": "linear"
- },
- "yaxis": {
- "autorange": True,
- "range": [0, 770207.3684210526],
- "title": {"text": "<b>Number of Subscribers</b>"},
- "type": "linear"
- }
- }
- fig = Figure(data=data, layout=layout)
- plot_url = py.plot(fig)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement