I want add to stage a label with specified font size.
val label = Label("label", Skin(Gdx.files.internal("uiskin.json")))
label.height = 20f
stage.addActor(label)
Changing label.height does not works, label is shown with some default size.
So the question is how to set label font size?
You can do only:
label.setFontScale(5.0f)
Also, you can specify font size in font file. It's the only way.
Try either setSize label.setSize(width, height) or setScale label.setScale(xyScaleFactor)
Is there any way to change cell size of Seaborn heatmap?
I found this but I cannot get it work as expected.
So, I have long text in y-axis labels. Since all of the texts are chopped off, I would like to shrink cell size of the heatmap much smaller. I don't need that big rectangle. (Highlighted just for example.)
(I hid label names.)
When I change the figure size by something like,
plt.figure(figsize=(8, 6)) or
figure.set_size_inches(12, 12)
the cell gets bigger as well so the texts remain chopped off.
Here is the code.
sns.set(font_scale=1.2)
ax0 = plt.axes()
ax1 = sns.heatmap(hmap, cbar=0, cmap="YlGnBu",linewidths=2, ax=ax0,vmax=3000, vmin=0)
ax1.set_title('test heatmap')
for item in ax1.get_yticklabels():
item.set_rotation(0)
for item in ax1.get_xticklabels():
item.set_rotation(0)
figure = plt.gcf() # get current figure
figure.set_size_inches(12, 12)
plt.savefig('test.png') , dpi=400)
Try using the square=True argument in your sns.heatmap call. This will constrain the heat map cells to a square aspect ratio.
ax1 = sns.heatmap(hmap, cbar=0, cmap="YlGnBu",linewidths=2, ax=ax0,vmax=3000, vmin=0, square=True)
You don't actually want to change the cell size but you want to shrink the size of the axes. Ways to to this:
use plt.tight_layout()
Provide more space to the side e.g. via fig.subplots_adjust(left=0.4)
Create an axes, which has the size you want, ax1 = fig.add_axes([0.4,0.2,0.5,0.6]) (where the numbers are [left, bottom, width, height] and use this axes to plot the heatmap, sns.heatmap(... , ax=ax1).
I'm trying to achieve an specific cell geometry width and height after implementing some scale and zoom on the graph(I want its new geometry attributes!).
var state = graph.view.getState(cell);
console.log(state.width, state.height);
I have created a chart using MPAndroid Chart. I want to know how can I increase the size of text value on top of each bar in MPAndroid Bar Chart? Which API should I use? I have circled the value in the attached picture in Red circle
you can try it by using
barDataset.setValueTextSize(12f);
where barDataset is BarDataSet
I was able to find the answer to my question after some trials. This is the code to set the font size of left and right Y-axis on a MPAndroidChart
import com.github.mikephil.charting.charts.CombinedChart;
//Code snippet
CombinedChart combinedChart = (CombinedChart) findViewById(R.id.chart);
YAxis yaLeft = combinedChart.getAxisLeft();
YAxis yaRight = combinedChart.getAxisRight();
yaLeft.setTextSize(14/*textSize*/);
yaRight.setTextSize(14/*textSize*/);
I'm trying to get the plot points in a scatter graph to size according to the frequency of values in a column of data. The data is coming from a questionnaire.
My questions are: What am I doing wrong, and what can I do to fix it?
I can push out a simple plot with x and y values coming from 2 columns of data. The X axis represents a level (1-100), and the Y axis represents a choice users can make for each level (1-4). For this plot I want to track how many people choose 1-4 on each level - so I need to capture that 1-4 has been selected, then indicate how many times.
Simple plot works fine, though those points have multiple occurrences.
Here's the code for that:
# Set up the graph
WT_Number = data.wt # This is the X axis
CFG_Number = data.cfg # This is the Y axis
wt_cfg_plot = figure(plot_width=1000, plot_height=400,
title="Control Form Groups chosen by WT unit")
# Set up the plot points, including the Hover Tool
cr = wt_cfg_plot.scatter(WT_Number, CFG_Number, size=7,
fill_color="blue",
line_color=None, alpha=0.7, hover_fill_color="firebrick",
hover_line_color=None, hover_alpha=1)
Problem: I then added a value count and set it as the size, to get the plot points to adjust according to the value frequency. But now it pumps out this chart and throws an error:
Plot points are reacting to the code, but now they're doing their own thing.
I added a variable for the value counts (cfg_freq), and used that as the size:
cfg_freq = data['cfg'].value_counts()*4
cr = wt_cfg_plot.scatter(WT_Number, CFG_Number, size=cfg_freq, fill_color="blue",
line_color=None, alpha=0.7, hover_fill_color="firebrick",
hover_line_color=None, hover_alpha=1)
Here's the the last part of the error being thrown:
File "/Applications/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 722, in setattr
(name, self.class.name, text, nice_join(matches)))
AttributeError: unexpected attribute 'size' to Chart, possible attributes are above, background_fill_alpha, background_fill_color, below, border_fill_alpha, border_fill_color, disabled, extra_x_ranges, extra_y_ranges, h_symmetry, height, hidpi, left, legend, lod_factor, lod_interval, lod_threshold, lod_timeout, logo, min_border, min_border_bottom, min_border_left, min_border_right, min_border_top, name, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset, outline_line_join, outline_line_width, plot_height, plot_width, renderers, responsive, right, tags, title, title_standoff, title_text_align, title_text_alpha, title_text_baseline, title_text_color, title_text_font, title_text_font_size, title_text_font_style, tool_events, toolbar_location, tools, v_symmetry, webgl, width, x_mapper_type, x_range, xgrid, xlabel, xscale, y_mapper_type, y_range, ygrid, ylabel or yscale