SNS BARPLOT not displaying data - seaborn

when I plot the below barplot with out the xlim, the barplot displays the data but when i apply the xlim the data disappears. if i switch the plot to a lineplot, the data re-appears?
\\
figs, axus = plt.subplots(nrows=1,ncols=1, figsize =(15,5), dpi=1080)
sns.barplot(x= RECAF.index,
y='Volume',
ax = axus,
data= RECAF,
label='Volume',
color ='k')
#specify 1 year time graph from current date
start = dt.datetime.strptime('2020-01-01', '%Y-%m-%d')
end = dt.datetime.today()
axus.set_xlim(left= start, right= end)
\\

Related

spring excel POI Apache set cell value text alignment center

i want to align center in header0 on Cell Value "testing testing"
val style = workbook.createCellStyle()
style.borderTop = 24.toShort() // double lines border
style.borderBottom = 24.toShort() // single line border
val font = workbook.createFont()
font.fontHeightInPoints = 15.toShort()
font.boldweight = XSSFFont.BOLDWEIGHT_BOLD
style.setFont(font)
style.borderRight = 6.toShort()
style.borderLeft = 6.toShort()
var rowNum = 11
var rowNumber = 1
header0.createCell(0).setCellValue("TESTING TESTING")
cell value will be align center

How to create a line chart with filter option and Data table for a R shiny dashboard?

I'm trying to create a line chart which is based on filter option along with data table. If I click the filter option it only changed in data table. But I want to set the filters for both Line chart and data table. Kindly help me.
My server.r code is:
output$grp_stacked_bar <- renderPlotly({
data <- ex
agg_sum <- aggregate(data$Result,by=list(Category = data$Donor_ID),FUN=sum, na.rm=TRUE)
p <- plot_ly(
data = agg_sum,
x = ~Category,
y = ~x,
type = "scatter",
mode = "lines+markers"
) %>% layout(title = "Functional Outlier Details", xaxis = list(title = "Donor_ID"),
yaxis = list(title = "Result"))
p
})
ui.r:
column(width = 10,
fluidRow(h2("Function Outlier Details",class="box-title",align="center"),
plotlyOutput(height="48vh",width ="82vw",outputId = "grp_stacked_bar")%>%withSpinner(color="#0dc5c1",hide.ui = FALSE,image.height = "73px",image.width = "145px",image= ".\\logo_gif2.gif"))
)
My sample dataset is:
enter image description here

Counting data for a certain period, enter the counting period from date to date

I need to calculate the percentile of financial data for a certain period from the current date to the historical date, for example, for the last 12 months. It would be ideal if there was such an opportunity to enter a counting period from date to date, please help me
//#version=5
indicator("Percent", "Percent", true)
// Getting inputs
percentage = input(title="Персентиль", defval=75)
source = input(title="Source", defval=close)
endMonth = input.int(title="Месяц", defval=12)
// Time
var tn = timenow
length = timestamp(year(tn), month(tn)-endMonth,1,0,0,0)
// Plot colors
col_perc = input(color.red, "Персентиль", group="Color Settings", inline="Персентиль")
// Calculating
percen = ta.percentile_linear_interpolation(source, length, percentage)
if barstate.islast
// Create the label once, the first time the block executes on the last bar.
var lbl = label.new(na, na)
// label's information.
label.set_xy(lbl, bar_index, percen)
label.set_text(lbl, str.tostring(percen, format.mintick))
label.set_color(lbl, color.red)
plot(percen, title="Персентиль", style=plot.style_line, color=col_perc)
Here is a working version of what I want, but it counts down from the historical date to the current one, across the entire data history. I need to calculate for a certain period, starting from the current date and ending with the date entered in the history
//#version=5
indicator("Percent", "Percent", true)
// Getting inputs
length = input.int(title="Длина", defval=10)
percentage = input(title="Персентиль", defval=75)
source = request.financial(syminfo.tickerid, "ENTERPRISE_VALUE_EBITDA", "FY")
// Plot colors
col_perc = input(color.red, "Персентиль", group="Color Settings", inline="Персентиль")
// Calculating
percen = ta.percentile_linear_interpolation(source, length, percentage)
if barstate.islast
// Create the label
var lbl = label.new(na, na)
// label's information.
label.set_xy(lbl, bar_index, percen)
label.set_text(lbl, str.tostring(percen, format.mintick))
label.set_color(lbl, color.red)
plot(percen, title="Персентиль", style=plot.style_line, color=col_perc)

Once I have created my rating scales and flipped the screen, they do not appear. What am I doing wrong?

Once I have created the ratingscales in PsychoPy, I cannot get them to show after showing my stimuli. What am I doing wrong?
Preparing experiment
Define window:
win = visual.Window(fullscr=True, color = 'Black')
Preparing stimuli
Pictures
Make list of images in my folder:
images = glob.glob("Yellow/*.jpg")
Randomize the order for pictures:
random.shuffle(images)
Prepare Fixation cross
stim_fix_left = visual.TextStim(win, '+') # Fixation cross is just the character "+". Units are inherited from Window when not explicitly specified.
stim_fix_left.pos = (0.5,0)
stim_fix_right = visual.TextStim(win, '+') # Fixation cross is just the character "+". Units are inherited from Window when not explicitly specified.
stim_fix_right.pos = (-0.5, 0)
Ratings
# the item to-be-rated or respond to:
whichred_left = visual.TextStim(win, text="Does left or right picture contain most red?", height=.04, units='norm')
whichred_left.pos = (0.5,0)
whichred_right = visual.TextStim(win, text="Does left or right picture contain most red?", height=.04, units='norm')
whichred_right.pos = (-0.5, 0)
Create stimuli
Show introduction message:
msg(intro, "white")
Show introduction to block:
msg(block_red, "red")
for i in images:
##Pictures
stim_fix_right.draw()
stim_fix_left.draw()
win.flip()#flip screen
core.wait(1.0)
#Picture 1
img1 = visual.ImageStim(win, image = i)#create visual stimuli
img1.pos = (0.4, 0)
img1.size = (0.5)
#Picture 2
img2 = visual.ImageStim(win, image = images[2])#create visual stimuli
img2.pos = (0.7, 0)
img2.size = (0.5)
#Picture 3
img3 = visual.ImageStim(win, image = i)#create visual stimuli
img3.pos = (-0.4, 0)
img3.size = (0.5)
#Picture 4
img4 = visual.ImageStim(win, image = images[2])#create visual stimuli
img4.pos = (-0.7, 0)
img4.size = (0.5)
#Drawing picures
img1.draw()#draw picture
img2.draw()#draw picture
img3.draw()#draw picture
img4.draw()#draw picture
win.flip()#flip screen
stopwatch.reset() #set clock
core.wait(1.0)
#Ratings
event.clearEvents()
# define window
winrating = visual.Window(size = (1280, 720), color = 'black', units='pix')
x, y = winrating.size # for converting norm units to pix
leftward = -0.35 * x / 2 # use pix units, because the drawing window's units are pix
rightward = -1 * leftward
# create a RatingScale object:
RatingLeft = visual.RatingScale(winrating, choices=map(str, range(1, 8)), mouseOnly=True, pos=(leftward, -y/6),
marker='circle', size=0.85, name='left')
RatingRight = visual.RatingScale(winrating, choices=map(str, range(1, 8)), low=0, high=8, markerStart=4,
leftKeys='left', rightKeys = 'right', acceptKeys='down', pos=(rightward, -y/6),
marker='circle', size=0.85, name='right')
while RatingLeft.noResponse or RatingRight.noResponse:
whichred_left.draw
whichred_right.draw
RatingLeft.draw()
RatingRight.draw()
winrating.flip()
if event.getKeys(['escape']):
core.quit()
There is no need to define a second window. Do all of your drawing into your originally defined window, win. This is created as a full screen window, so I'd assume that the second window, winrating is hidden behind it and any drawing wouldn't be visible.

What is the best way to display a large text file in MATLAB GUIDE?

How can a MATLAB GUIDE control be used to display the contents of a text file in a GUI? The text file may be very long or very wide so it should have the ability to have vertical and horizontal scroll bars.
A multi-line editbox may be the best choice to display the text. Example:
%# read text file lines as cell array of strings
fid = fopen( fullfile(matlabroot,'license.txt') );
str = textscan(fid, '%s', 'Delimiter','\n'); str = str{1};
fclose(fid);
%# GUI with multi-line editbox
hFig = figure('Menubar','none', 'Toolbar','none');
hPan = uipanel(hFig, 'Title','Display window', ...
'Units','normalized', 'Position',[0.05 0.05 0.9 0.9]);
hEdit = uicontrol(hPan, 'Style','edit', 'FontSize',9, ...
'Min',0, 'Max',2, 'HorizontalAlignment','left', ...
'Units','normalized', 'Position',[0 0 1 1], ...
'String',str);
%# enable horizontal scrolling
jEdit = findjobj(hEdit);
jEditbox = jEdit.getViewport().getComponent(0);
jEditbox.setWrapping(false); %# turn off word-wrapping
jEditbox.setEditable(false); %# non-editable
set(jEdit,'HorizontalScrollBarPolicy',30); %# HORIZONTAL_SCROLLBAR_AS_NEEDED
%# maintain horizontal scrollbar policy which reverts back on component resize
hjEdit = handle(jEdit,'CallbackProperties');
set(hjEdit, 'ComponentResizedCallback',...
'set(gcbo,''HorizontalScrollBarPolicy'',30)')
To enable horizontal scrolling, we must get a handle to the embedded JScrollPane java component. I am using the excellent FINDJOBJ function. Then we set the HorizontalScrollBarPolicy property to javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED (= 30) as explained in this post. I also disabled editing of the text (read only).
Here is my solution for a generic text file called "textfile.txt":
f = figure('menu','none','toolbar','none');
fid = fopen('textfile.txt');
ph = uipanel(f,'Units','normalized','position',[0.4 0.3 0.5 0.5],'title',...
'Display window');
lbh = uicontrol(ph,'style','listbox','Units','normalized','position',...
[0 0 1 1],'FontSize',9);
indic = 1;
while 1
tline = fgetl(fid);
if ~ischar(tline),
break
end
strings{indic}=tline;
indic = indic + 1;
end
fclose(fid);
set(lbh,'string',strings);
set(lbh,'Value',1);
set(lbh,'Selected','on');
Here is my solution. Good Luck
fid = fopen(filename);
str = textscan(fid, '%s', 'Delimiter','\n'); str = str{1};
fclose(fid);
f=figure;
hPan = uipanel(f,'Units','normalized');
uicontrol(hPan, 'Style','listbox', ...
'HorizontalAlignment','left', ...
'Units','normalized', 'Position',[0 0 1 1], ...
'String',str);

Resources