Errorbar formatting in octave - matlab

I was plotting some two dimensional plot in Octave my code is given below
A=dlmread('data.txt');
x=A(:,1);
y=A(:,2);
err=A(:,3);
errorbar(x,y,err,'or','markerfacecolor','r','markersize',5)
and the issue is that the markerfacecolor is not working and markersize is also not working. How could I solve this issue ?
The error shown in command window is as follows
error: errorbar: data argument 5 must be numeric
error: called from
__errplot__ at line 44 column 7
errorbar at line 184 column 10
rbar at line 5 column 1
and this code plots fine if I remove markerfacecolor and markersize. I mean it gives an output without markerfacecolor , markersize rather than showing errror in command window. Please help
The file data.txt is of this form
1.0 3.1 0.21
2.0 4.1 0.29
3.1 5.2 0.42
4.0 6.1 0.53
4.9 7.7 0.63
6.0 8.0 0.72
6.0 9.0 0.75
7.0 13.1 0.21
8.0 23.1 0.21
9.0 29.3 0.21
10.0 30.1 8.21
11.1 28.7 2.1
12.0 23.1 2.2
13.1 18.1 1.61

You can set markerfacecolor and markersize after drawing your errorbars. i.e.
h = errorbar(x,y,err,'or');
set(h,'markerfacecolor','r','markersize',5);
Result:

Related

postgres memory performance vs sharedfileset in pgsql_tmp directory

We are running a postgres cluster with 32 CPU and 84 GB RAM in production with db size close to ~800GB.
It has replica setup as well with streaming wall replication (another host) kept as hot-standby.
Linux 2.6.32-642.6.2.el6.x86_64 (CentOS 6.4, upgrade pending)
Postgres Version - 11.11
We see some weird behaviour since last month with our instance having memory usage going every 80 hours even without having any cronjobs running at the specified moment (usually cron setup works specified-time/hourly/daily/weekly/monthly).
At the same time we see huge(~70gb) of temp files , e.g pgsql_tmp90128.0.sharedfileset/i231326of1048576.p2.0) being created and not getting deleted even after the postgres started working fine after 10 minutes.
My related settings for postgres memory utilization are following
work_mem 8 MB
temp_buffers 8 MB
shared_buffers 22 GB
max_connections 2500
During the window we see system cpu shoots up and came down again once memory refreshes.
$ sar -f /var/log/sa/sa17 -s 08:36:00 -e 08:47:00
>
08:36:21 AM CPU %user %nice %system %iowait %steal %idle
08:37:21 AM all 18.66 0.01 26.05 9.54 0.00 45.74
08:38:21 AM all 5.21 0.01 81.71 2.11 0.00 10.96
08:39:21 AM all 2.71 0.01 96.90 0.04 0.00 0.34
08:40:08 AM all 1.55 0.00 98.44 0.00 0.00 0.00
08:41:08 AM all 9.96 0.02 38.49 2.20 0.00 49.34
08:42:08 AM all 0.12 0.00 1.50 1.63 0.00 96.74
08:43:08 AM all 0.10 0.01 1.32 1.79 0.00 96.79
08:44:08 AM all 0.20 0.01 2.25 0.76 0.00 96.79
08:45:08 AM all 1.74 0.01 1.83 5.89 0.00 90.53
08:46:08 AM all 10.09 0.01 7.37 18.90 0.00 63.63
Average: all 5.11 0.01 34.18 4.36 0.00 56.34
RAM usage pattern
$ sar -r -f /var/log/sa/sa17 -s 08:36:00 -e 08:47:00
>
08:36:21 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit
08:37:21 AM 430888 88277480 99.51 12176 23869496 79753764 87.83
08:38:21 AM 420612 88287756 99.53 7212 23425316 80174100 88.29
08:39:21 AM 424276 88284092 99.52 3552 23246368 81653952 89.92
08:40:08 AM 417172 88291196 99.53 4316 22819904 82023344 90.33
08:41:08 AM 84692800 4015568 4.53 978760 1124852 25077588 27.62
08:42:08 AM 78749436 9958932 11.23 2098912 1139416 25067128 27.61
08:43:08 AM 73598564 15109804 17.03 3065228 1140756 25067516 27.61
08:44:08 AM 70213124 18495244 20.85 3175984 1141168 25067016 27.61
08:45:08 AM 56661972 32046396 36.13 3179640 13233168 27063188 29.80
08:46:08 AM 30585252 58123116 65.52 3207036 30364932 32130264 35.38
Average: 39619410 49088958 55.34 1573282 14150538 48307786 53.20
I have the following questions in this respect:
What can be the probable cause of this behaviour of memory usage going dropped at regular interval ?
What these temp_files are and is it safer to delete manually ?
Is there a bug in Postgres, why it's not getting automatically
cleaned, related-thread
I see several run of CHECKPOINT and even then the temp files are not getting cleared.

Net::SSH2::Simple failed after update to Windows10

there
On Net::SSH2::Simple,
It has been no longer connected by ssh after update Windows7 to Windows10.
With following error.
Net::SSH2::net_ss_timeout: invalid object Net::SSH2::Simple=SCALAR(0x3f5c218) at C:/Strawberry/perl/vendor/lib/Net/SSH2.pm line 111.
at C:/Strawberry/perl/vendor/lib/Net/SSH2.pm line 111.
Net::SSH2::connect(Net::SSH2::Simple=SCALAR(0x3f5c218), "xxxx.com", 22) called at C:/tool/eclipse_classic/workspace/test/work14.pl line 98
(in cleanup) Net::SSH2::net_ss_DESTROY: invalid object Net::SSH2::Simple=SCALAR(0x3f5c218) at C:/tool/eclipse_oxygen/eclipse/workspace/.metadata/.plugins/org.epic.debug/perl5db.pl line 4211.
My code are
use Net::SSH2::Simple;
$ssh2 = Net::SSH2::Simple->new();
$ssh2->connect( 'xxxx.com', 22 ) ;
$ssh2->auth_password( 'username', 'passwd' );
Error comes up at "$ssh2->connect" line.
But
This code works fine by using Net::SSH2.
Only Net::SSH2::Simple doesn't work.
To xxxx.com connection is fine. and no username,password mistakes found.
How can I fix that.
Windows10 64bit
Strawberry Perl 5.30.1.1 (64bit)
Eclipse Oxygen
EPIC 0.77
Thanks
Net::SSH2::Simple 0.01 was released Dec 13 2009. At that time Net::SSH2 was at 0.28 (2009-10-24), it is now at 0.70 (2019-3-17).
I got Net::SSH2::Simple to work on Windows10 64bit / Strawberry Perl 5.30.0.1 (64bit) by installing the earlier version 0.58 (2015-12-20) of Net::SSH2 using
cpan install SALVA/Net-SSH2-0.58.tar.gz
Version 0.59_20 (2016-05-11) gives the 'net_ss_timeout: invalid object' error . The change log for version 0.59_01 has this warning
** WARNING: this release includes lots of changes, some
visible, most internal. Regressions are expected. Also,
it introduces some minor backward incompatible changes -
but in those cases, the old behavior was broken or insane
anyway.

Getting "output eDP-1 not found" from xrandr after upgrading to Ubuntu 17.10 when I try to change brightness

I have a ThinkPad X1 Yoga (2nd gen) and when running Ubuntu 17.04 I could change the brightness like this:
$ xrandr --output eDP-1 --brightness .7
Now, when I do that under 17.10 I get this:
warning: output eDP-1 not found; ignoring
xrandr: Need crtc to set gamma on.
When I hit brightness up and down buttons I see the numerical value in this file changing properly:
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/brightness
But xrandr reports a new label:
$ xrandr -q
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192
XWAYLAND0 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 310mm x 180mm
2560x1440 59.96*+
I've tried replacing eDP-1 with XWAYLAND0 but it returns 0 with no errors and nothing at all happens to the brightness.
$ xrandr --output XWAYLAND0 --brightness 0.5
$ echo $?
0
Would love some help on getting brightness settings working again. Right now it's stuck on full brightness all the time, which isn't great for the battery.
xrandr is made for X11 and won't work on Wayland. At least I'm not aware of any Wayland protocol for this yet (though one could easily be made).
There might be some gnome-shell (if that's the compositor you're using) tool for this, though, but I'm not too familiar with gnome.

I am starting to use Perl Tk for my UI design in. I created a small code in perl and got the following error

The error is couldn't connect to display ":0" at /usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-threads/Tk/MainWindow.pm line 53.
MainWindow->new() at ./PerlUI.pl line 6.
The code is:
#!/usr/bin/perl -w
use strict;
use Tk;
my $mw=MainWindow->new;
$mw->geometry("200x100");
$mw->title("Hello World!!");
$mw->Label(-text=>"Hello World")->pack();
$mw->Button(-text=>"Close",-command=>sub{exit})->pack();
MainLoop;
You need to start X first.
perl hello_world_tk.pl
couldn't connect to display ":0" at /usr/lib/perl5/vendor_perl/5.22/i686- cygwin-threads-64int/Tk/MainWindow.pm line 53.
MainWindow->new() at hello_world_tk.pl line 6.
Start X by invoking X, which will open up a new window and then run your script.
X &
Vendor: The Cygwin/X Project
Release: 1.18.4.0
OS: CYGWIN_NT-6.1 EAPB8CA3AA75D7E 2.6.0(0.304/5/3) 2016-08-31 14:27 i686
OS: Windows 7 Service Pack 1 [Windows NT 6.1 build 7601] (Win32)
Package: version 1.18.4-1 built 2016-07-22
winInitializeScreenDefaults - primary monitor w 1280 h 1024
winInitializeScreenDefaults - native DPI x 96 y 96
XWin was started with the following command line:
X
.... more X output
# Now run your script
perl hello_world_tk.pl

Matlab - Smoothing crooked and aliased lines in plots

I'm sure this has an easy solution, but I can't get a way out of it. When I plot a thick line in Matlab and print it (r550) I get the crooked line seen below. I tried the 'smooth' command to no avail. Here's the code:
plot(x,y1,'b','LineWidth',8);hold on
plot(x,y2,'r','LineWidth',8);hold on
print -djpeg -r550 figure1
here's the blue line values (y1):
y1 = [1.9 1.81 1.73 1.65 1.63 1.6 1.65 1.59 1.54 1.52 1.47 1.52 1.53 1.48 1.44 1.43 1.‌​39 1.38 1.34 1.33 1.33 1.32 1.29 1.26 1.23 1.22 1.24 1.23 1.21 1.22 1.22 1.2 1.25‌​ 1.25 1.22 1.22 1.2 1.18 1.19 1.17 1.15 1.13 1.15 1.13 1.11 1.09 1.08 1.07 1.12 1‌​.1 1.1 1.08 1.08 1.07 1.05 1.04 1.03 1.01 1.01 1.01 1.01 1 1 1 1 1 0.99 1.01 1.01‌​ 1.01 1 0.99 0.98 0.98 0.98 0.97 0.97 0.97 0.97 0.97 0.97 0.96 0.96 0.96 0.96 0.9‌​5 0.95 0.99 0.98 1 0.99 0.98 0.98 0.98 0.98 0.98 0.97 0.97 0.97 0.96 0.95 0.94 0.‌​94 0.93 0.93 0.93 0.92 0.93 0.92 0.91 0.92 0.92 0.91 0.92 0.93 0.92 0.91 0.91 0.9‌​1 0.9 0.89 0.89 0.89 0.88 0.88];
Any help to make it look nice and smooth? Thanks!
---------WITH DMETA--------------
I used a resolution of 600dpi. Next figure doesn't look bad, but in a Word file or Powerpoint doesn't shows as good. Any ideas??
If you work in Windows, the good option is to export to a windows meta file (.emf) instead of jpeg:
print -dmeta figure1
Additionally, it looks much better in MS Office documents (vector format).
You can always convert emf to jpeg if required.
This problem is caused by how matlab renders objects for saving.
One thing you could try is the HG2 update to MATLAB (link). It is a MAJOR improvement to how visually appealing graphics are, however it can cause matlab to crash.
A workaround that you might find good enough is to add a marker plot for each data line. such as
plot(x,y1,'.b','MarkerSize',24);
Placing a marker at each node will fill in the rough edges of the plot. You might have to play around with the marker size a little.