| 1 |
{ |
| 2 |
"cells": [ |
| 3 |
{ |
| 4 |
"cell_type": "code", |
| 5 |
"execution_count": null, |
| 6 |
"id": "9fda8050", |
| 7 |
"metadata": {}, |
| 8 |
"outputs": [], |
| 9 |
"source": [ |
| 10 |
"from bqplot import *\n", |
| 11 |
"\n", |
| 12 |
"x_data = range(10)\n", |
| 13 |
"y_data = [i ** 2 for i in x_data]\n", |
| 14 |
"\n", |
| 15 |
"x_sc = LinearScale()\n", |
| 16 |
"y_sc = LinearScale()\n", |
| 17 |
"\n", |
| 18 |
"ax_x = Axis(label='Test X', scale=x_sc, tick_format='0.0f')\n", |
| 19 |
"ax_y = Axis(label='Test Y', scale=y_sc,\n", |
| 20 |
" orientation='vertical', tick_format='0.2f')\n", |
| 21 |
"\n", |
| 22 |
"line = Lines(x=x_data,\n", |
| 23 |
" y=y_data,\n", |
| 24 |
" scales={'x': x_sc, 'y': y_sc},\n", |
| 25 |
" colors=['red', 'yellow'])\n", |
| 26 |
"\n", |
| 27 |
"fig = Figure(axes=[ax_x, ax_y], marks=[line])\n", |
| 28 |
"fig" |
| 29 |
] |
| 30 |
}, |
| 31 |
{ |
| 32 |
"cell_type": "code", |
| 33 |
"execution_count": null, |
| 34 |
"id": "26b67379", |
| 35 |
"metadata": {}, |
| 36 |
"outputs": [], |
| 37 |
"source": [ |
| 38 |
"x_sc = LinearScale()\n", |
| 39 |
"y_sc = LinearScale()\n", |
| 40 |
"\n", |
| 41 |
"ax_x = Axis(label='Test X', scale=x_sc, num_ticks=20)\n", |
| 42 |
"ax_y = Axis(label='Test Y', scale=y_sc,\n", |
| 43 |
" orientation='vertical', num_ticks=3)\n", |
| 44 |
"\n", |
| 45 |
"line = Lines(x=x_data,\n", |
| 46 |
" y=y_data,\n", |
| 47 |
" scales={'x': x_sc, 'y': y_sc},\n", |
| 48 |
" colors=['red', 'yellow'])\n", |
| 49 |
"\n", |
| 50 |
"fig = Figure(axes=[ax_x, ax_y], marks=[line])\n", |
| 51 |
"fig" |
| 52 |
] |
| 53 |
}, |
| 54 |
{ |
| 55 |
"cell_type": "code", |
| 56 |
"execution_count": null, |
| 57 |
"id": "dd4d63c0", |
| 58 |
"metadata": {}, |
| 59 |
"outputs": [], |
| 60 |
"source": [ |
| 61 |
"x_sc = LinearScale()\n", |
| 62 |
"y_sc = LinearScale()\n", |
| 63 |
"\n", |
| 64 |
"ax_x = Axis(label='Test X', scale=x_sc, num_ticks=20)\n", |
| 65 |
"ax_y = Axis(label='Test Y', scale=y_sc,\n", |
| 66 |
" orientation='vertical', num_ticks=3, tick_values=[0, 10, 80])\n", |
| 67 |
"\n", |
| 68 |
"line = Lines(x=x_data,\n", |
| 69 |
" y=y_data,\n", |
| 70 |
" scales={'x': x_sc, 'y': y_sc},\n", |
| 71 |
" colors=['red', 'yellow'])\n", |
| 72 |
"\n", |
| 73 |
"fig = Figure(axes=[ax_x, ax_y], marks=[line])\n", |
| 74 |
"fig" |
| 75 |
] |
| 76 |
}, |
| 77 |
{ |
| 78 |
"cell_type": "code", |
| 79 |
"execution_count": null, |
| 80 |
"id": "5cb5b165", |
| 81 |
"metadata": {}, |
| 82 |
"outputs": [], |
| 83 |
"source": [ |
| 84 |
"x_sc = LinearScale()\n", |
| 85 |
"y_sc = LinearScale()\n", |
| 86 |
"\n", |
| 87 |
"ax_x = Axis(label='Test X', scale=x_sc, num_ticks=20, tick_rotate=-45, tick_style={'font-size': 10})\n", |
| 88 |
"ax_y = Axis(label='Test Y', scale=y_sc,\n", |
| 89 |
" orientation='vertical', tick_values=[0, 10, 80])\n", |
| 90 |
"\n", |
| 91 |
"line = Lines(x=x_data,\n", |
| 92 |
" y=y_data,\n", |
| 93 |
" scales={'x': x_sc, 'y': y_sc},\n", |
| 94 |
" colors=['red', 'yellow'])\n", |
| 95 |
"\n", |
| 96 |
"fig = Figure(axes=[ax_x, ax_y], marks=[line])\n", |
| 97 |
"fig" |
| 98 |
] |
| 99 |
} |
| 100 |
], |
| 101 |
"metadata": { |
| 102 |
"kernelspec": { |
| 103 |
"display_name": "Python 3", |
| 104 |
"language": "python", |
| 105 |
"name": "python3" |
| 106 |
}, |
| 107 |
"language_info": { |
| 108 |
"codemirror_mode": { |
| 109 |
"name": "ipython", |
| 110 |
"version": 3 |
| 111 |
}, |
| 112 |
"file_extension": ".py", |
| 113 |
"mimetype": "text/x-python", |
| 114 |
"name": "python", |
| 115 |
"nbconvert_exporter": "python", |
| 116 |
"pygments_lexer": "ipython3", |
| 117 |
"version": "3.9.5" |
| 118 |
} |
| 119 |
}, |
| 120 |
"nbformat": 4, |
| 121 |
"nbformat_minor": 5 |
| 122 |
} |