w*s 发帖数: 7227 | 1 Ok i found this code online, works fine except i want to see date in the
xlabel.
import numpy as np
import pandas
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick, candlestick2
import matplotlib.dates as mdates
from pandas.io.data import DataReader
import datetime
# get daily stock price data from yahoo finance for S&P500
start = datetime.datetime(2015, 11, 1)
end = datetime.datetime(2016, 2, 11)
SP = DataReader("spy", "yahoo", start, end)
SP.reset_index(inplace=True)... 阅读全帖 |
|
E*******0 发帖数: 465 | 2 int XY[][]; //coordinate points.
int numXY; //length of points in the set
bool IsInSet(Xin, Yin)
{
long Xlabel, Ylabel;//assume 64 bits long type.
//First, we segment the points set into several 64-bit sets and one
sit with smaller than 64 bits.
int iteNum = numXY / 64; // number of sets with 64 bits.
int remianNum = numXY % 64; // number of set with smaller 64 bits
//output the points in the set with smaller 64 bits.
Xlabel=0;
Ylabel=0
for (int j=1; j<=remainNum; j++... 阅读全帖 |
|
m******t 发帖数: 273 | 3 【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: solve integral eq. embeeded with another integral eq.
发信站: BBS 未名空间站 (Sun Mar 23 14:20:18 2014, 美东)
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
impor... 阅读全帖 |
|
f****e 发帖数: 15 | 4 要画两个图,我用了subplot function,但就是不知道怎样分别给两个图
加标题和坐标名称
我用的是
subplot(2,1,1)
title('title 1')
xlabel('x1')
ylabel('y1')
plot(y,x)
subplot(2,1,2)
tot;e('title2')
xlabel('x2')
ylabel('y2')
plot(y,x)
etc |
|
f****e 发帖数: 15 | 5 要画两个图,我用了subplot function.
可是不知道怎样分别!!
给两个subplots加上标题,坐标名称。以下是我的code,但不work.
subplot(2,1,1) ;
title('title 1','fontsize',12);
xlabel('x 1');
ylabel('y 1');
plot(y,x);
grid on;
subplot(2,1,2) ;
title('title 2','fontsize',12)
xlabel('x 2');
ylabel('y 2');
plot(y,x) ;
grid on; |
|
f**d 发帖数: 768 | 6 subplot(2,1,1);
plot(y,x);
title('title 1','fontsize',12);
xlabel('x 1');
ylabel('y 1');
grid on;
subplot(2,1,2) ;
plot(y,x) ;
title('title 2','fontsize',12)
xlabel('x 2');
ylabel('y 2');
grid on; |
|
m******t 发帖数: 273 | 7 【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: solve integral eq. embeeded with another integral eq.
发信站: BBS 未名空间站 (Sun Mar 23 14:20:18 2014, 美东)
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
impor... 阅读全帖 |
|
m******t 发帖数: 273 | 8 I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
import sympy as syp
lb = 0
def integrand2(x, a):
print("integrand2 called")
return x**(a-1) * exp(-x)
def integrand1(x, b, c):
print(... 阅读全帖 |
|
f*******a 发帖数: 663 | 9 开始忘贴代码了,有朋友要求,就把修改后的代码贴在这里。改动不多,可以部分提升
效率。原来的也没删,注释掉了。供参考。
=========================================================================
clear;
close all
disp('The only input needed is a distance matrix file')
disp('The format of this file should be: ')
disp('Column 1: id of element i')
disp('Column 2: id of element j')
disp('Column 3: dist(i,j)')
if(0)
% mdist=input('name of the distance matrix file (with single quotes)?\n'
);
mdist = 'example_distances.dat';
disp('Reading input dis... 阅读全帖 |
|
m******t 发帖数: 273 | 10 【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: solve integral eq. embeeded with another integral eq.
发信站: BBS 未名空间站 (Sun Mar 23 14:20:18 2014, 美东)
I need to solve an integral equation embedded with another integral equation
by python 3.2 in win7.
There are 2 integral equations.
The code is here:
import numpy as np
from scipy.optimize.minpack import fsolve
from numpy import exp
from scipy.integrate.quadpack import quad
import matplotlib.pyplot as plt
impor... 阅读全帖 |
|
s********e 发帖数: 62 | 11 figure; % open a new figure window
plot(x, y, 'rx', 'MarkerSize', 10); % Plot the data
ylabel('Profit in $10,000s'); % Set the y-axis label
xlabel('Population of City in 10,000s'); % Set the x-axis label |
|
k*****e 发帖数: 22013 | 12 clf; clc; clear all;
syms x y
eq1 = ((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+3/7*sqrt(33
))/(y+3/7*sqrt(33)))-1);
eq2 = (abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y);
eq3 = (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(
x)-y);
eq4 = (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)
-.5)))-y);
eq5 = (2.25*sqrt(abs((x-.5)*(x+.5))/((.5-x)*(.5+x)))-y);
eq6 = (6*sqrt(10)/7+(1.5-.5*abs(x))*sqrt(abs(abs(x)-1)/(abs(x)-1... 阅读全帖 |
|
c******d 发帖数: 906 | 13 例如
xlabel('\frac{a}{b}')
这个就报错,加了 'Interpreter','latex'... 还是不行
请教一下校友 |
|
a******9 发帖数: 54 | 14 or
xlabel1 = xlabel('$$\frac{a}{b}$$')
set(xlabel1,'interpret','latex') |
|
c******n 发帖数: 4965 | 15 【 以下文字转载自 Linux 讨论区 】
【 原文由 creation 所发表 】
input trash.mp
beginfig(1)
draw begingrf(5in,4in);
rdata("datafile",1);
rdata("datafile",2);
rdata("data2",1);
rdata("data2",2);
matplot("0 1 cg ddash t*");
matplot("2 3 cr ddot tx");
ylabel("blahblah");
xlabel("red is sqrt(x)*1000, green is sqr(x)");
finishgrf; endfig;
end |
|
m******w 发帖数: 8 | 16 hi,
thanks. I have following matlab code. How to add another line of sta
tement to do the rotation for the x-axis? Just tried google and found n
othing helpful. thanks.
xlabel('Benchmarks','FontSize',18)
ylabel('Performance Increase (%)','FontSize',18)
set(gca,'XTickLabel',{'bzip2', 'crafty', 'gap', 'gcc', 'gzip', 'mcf', 'p
arser', 'perlbmk', 'twolf', 'vortex', 'vpr'}) |
|
|
|
|
x********3 发帖数: 566 | 20 谢谢kkff的指点,通过datenum和datestr命令,我把时间换成了日期,比如01-Jan-
2002 00:00:00,一直到01-Dec-2003 23:00:00,这个数组好像被matlab当作了字符串
而不是数值,因此我在画图的时候有了问题。比如x轴是我转换成日期的时间,y轴和相
应的数值,我似乎不能画图。由于我的x轴被当成了20列(比如,01-Dec-2003 23:00:
00,共20列),因此总是无法画图。
我也试着用datenum的产生的时间序列数字作为x轴,这样画出图后,在xticklabel以及
xlabel上设置转换,似乎不成功,估计是我没用对这个功能。请再指点一下。谢谢。 |
|
b*******d 发帖数: 353 | 21 我猜你这里的df是指dataframe?
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Da
里面的kind有
kind : str
‘line’ : line plot (default)
‘bar’ : vertical bar plot
‘barh’ : horizontal bar plot
‘hist’ : histogram
‘box’ : boxplot
‘kde’ : Kernel Density Estimation plot
‘density’ : same as ‘kde’
‘area’ : area plot
‘pie’ : pie plot
‘scatter’ : scatter plot
‘hexbin’ : hexbin plot |
|
|
T*******n 发帖数: 493 | 23 # This gnuplot script will get you started.
# You need to transpose the data and save it in the format
# shown at the end of the script.
# If you want to color-fill the bars, you'll need to edit the
# EPS file that is created.
set terminal postscript eps enhanced color solid "Times-Roman" 20
set output "bargraph.eps"
set xrange [0:5]
set yrange [0:8000]
set xlabel "cases"
set ylabel "values"
set xtics ("case 1" 1, "case 2" 2, "case 3" 3, "case 4" 4)
set grid ytics
set mytics 5
set key width -9 b |
|
N**D 发帖数: 10322 | 24 xlabel('$\sqrt{xx}$', 'interpreter', 'latex');
you may not need the $. |
|
y****e 发帖数: 1012 | 25 我想同时画bar和line,请问能在同一个图里面输出吗?
这样行不行呢?
set term postscript eps color blacktext "Helvetica" 24
set output '600030macd.eps'
set autoscale # scale axes automatically
unset log # remove any log-scaling
unset label # remove any previous labels
set xtic auto # set xtics automatically
set ytic auto # set ytics automatically
set title "MACD Chart"
set xlabel "date"
set ylabel "s |
|
D****r 发帖数: 309 | 26 set term postscript eps color blacktext "Helvetica" 24
set output '600030macd.eps'
set autoscale # scale axes automatically
unset log # remove any log-scaling
unset label # remove any previous labels
set xtic auto # set xtics automatically
set ytic auto # set ytics automatically
set title "MACD Chart"
set xlabel "date"
set ylabel "score"
#set key 0.01,100
set xrange [0 |
|
y****e 发帖数: 1012 | 27 set term postscript eps color blacktext "Helvetica" 24
set output 'p1.eps'
set autoscale # scale axes automaticallyun
set label # remove any previous labels
set xtic auto # set xtics automatically
set ytic auto # set ytics automatically
set title "I/O Traffic"
set xlabel "Interval(5s)"
set ylabel "Data(KB)"
set key 0.01,10000
set xr [0:100]
set yr [0:10000]
plot "p1.tmp" using 1:2 title 'r0' ... 阅读全帖 |
|
r*****z 发帖数: 906 | 28 我用的是gnuplot 4.4,所以需要对你的命令做一点儿修改。
修改后的如下:
set term postscript eps color blacktext "Helvetica" 24
set output 'p1.eps'
set autoscale # scale axes automaticallyun
unset log
unset label
set xtic auto # set xtics automatically
set ytic auto # set ytics automatically
set title "I/O Traffic"
set xlabel "Interval(5s)"
set ylabel "Data(KB)"
set key at 1,100
set xr [0:100]
set yr [0:10000]
plot "p1.tmp" using 1:2 title 'r0' with li... 阅读全帖 |
|
w**k 发帖数: 58 | 29 use xlabel ( 'root square (2)') |
|
S***y 发帖数: 186 | 30 Seems "set encoding iso-8859-1", then {\305} can do it.
But don't know how to write it. What's the syntax?
e.g. I want to set x label using
###
set encoding iso_8859_1
set xlabel 'Distance ({\305})'
set encoding default
###
This doesn't get the angstrom symbol.
Thanks! |
|
l*******G 发帖数: 1191 | 31 anglev=3000*2*pi/60.0 %angular velocity rad/sec
dt=2*pi/anglev/600; %T/600
t=(0:dt:60); %sec %one minute total
v=25; %mm/sec
xo=0+v*t; %center of rotation
yo=xo*0;
R=10 ; %10mm away from xo, yo
angle=0+t*anglev; %angle relative to x axis
xc=xo+R*cos(angle); %center of cirlcle
yc=yo+R*sin(mod(angle,2*pi));
%draw the circle
r=5; %5mm circle
angc=(0:0.1:2*pi);
for i=1:length(t)
x=xc(i)+cos(angc)*r; %circle
y=yc(i)+s... 阅读全帖 |
|
r****y 发帖数: 1437 | 32
Not always works.
Some commands do not accept this ... ,
e. g.
title xlabel, ylabel, etc. |
|
r****y 发帖数: 1437 | 33
Just same as line plots, xlabel( ), ylabel( )
If you do not want the contour values showing up, just wanna
legend, just
h = contour( *** )
b = clabel(h, 'manual');
and change "string" properties of b
Or even simpler,
gtext( your_legend)
click to whereever you wanna put
[c, h] = contour( ***);
get(h(i))
you will see the properties of line, then change it, e.g.
for i = 1:length(h)
set(h(i), 'L |
|
h******g 发帖数: 69 | 34 x=c('2010-08-20', '2010-08-30')
t = strptime(x, "%Y-%m-%d")
plot(t,y)
xlabel的下标是 "八月", 怎么改成英文?
Window7 64 bits Home Edition
R 2.11.1 Windows 32 bits version
多谢! |
|