pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Functions | |
def | data_from_dict (data, panda=True, xy=True) |
Converts a Python dictionary into a pandas DataFrame or altair NamedData More... | |
def | data_from_url (url) |
Loads data from a URL into an altair UrlData object. More... | |
def | data_from_array (array) |
Loads data from an array (list) into an altair InlineData object. More... | |
def | make_chart (data, mark_type='point', mark_props={}, x_title='x', x_props={}, y_title='y', y_props={}, color='x:N', shape='x:N', text_col=None, text_props={}, other_axes_and_channels={}, interactive=True, scale_factor=1.0, svg=False, save_file='chart.html', on_save=None) |
Constructs an Altair graph from user data optionally saving it to an HTML file. More... | |
def pycross.utils.graphs.data_from_array | ( | array | ) |
Loads data from an array (list) into an altair InlineData
object.
array | list data values |
InlineData
object def pycross.utils.graphs.data_from_dict | ( | data, | |
panda = True , |
|||
xy = True |
|||
) |
Converts a Python dictionary into a pandas DataFrame
or altair NamedData
panda | bool True to convert to a pandas DataFrame object; False to convert to a NamedData object |
xy | bool if True , the data dict will be aggregated into a dict with 2 keys: x : all keys and y : all values; e.g. if data is originally: {'a':}
it will be transformed into:
```{'x': ['a', 'b', 'c'], 'y': [1, 2, 3]
|
DataFrame
|NamedData
converted object def pycross.utils.graphs.data_from_url | ( | url | ) |
Loads data from a URL into an altair UrlData
object.
url | str URL string |
UrlData
object def pycross.utils.graphs.make_chart | ( | data, | |
mark_type = 'point' , |
|||
mark_props = {} , |
|||
x_title = 'x' , |
|||
x_props = {} , |
|||
y_title = 'y' , |
|||
y_props = {} , |
|||
color = 'x:N' , |
|||
shape = 'x:N' , |
|||
text_col = None , |
|||
text_props = {} , |
|||
other_axes_and_channels = {} , |
|||
interactive = True , |
|||
scale_factor = 1.0 , |
|||
svg = False , |
|||
save_file = 'chart.html' , |
|||
on_save = None |
|||
) |
Constructs an Altair graph from user data optionally saving it to an HTML file.
data | DataFrame |NamedData source data |
mark_type | str graph mark type, any of: 'area', 'bar', 'circle', 'geoshape', 'image', 'line', 'point', 'rect', 'rule', 'square', 'text', 'tick', 'boxplot', 'errorband', 'errorbar' |
mark_props | dict property dictionary for the marks |
x_title | str label for the horizontal axis |
x_props | dict property dictionary for the horizontal axis |
y_title | str label for the vertical axis |
y_props | dict property dictionary for the vertical axis |
color | str |dict graph color settings |
shape | str |dict graph shape settings |
text_col | str text labels for the marks |
text_props | dict proprties of the text labels |
other_axes_and_channels | dict additional axes / channels |
interactive | bool whether the chart is interactive or static |
scale_factor | float scale (zoom) factor for graph |
svg | bool whether to use the SVG (vector image) renderer |
save_file | str path to output file (HTML) |
on_save | callable callback function called when the chart has been saved to the file; takes one argument – the output file path |