python使用markerarray显示点

python使用markerarray显示点,第1张

方法与举例如下:
import matplotlibpyplot as plt

import numpy as np
ypoints = nparray([1,3,4,5,8,9,6,1,3,4,5,2,4])
pltplot(ypoints, marker = 'o')
pltshow()
绘图过程如果我们想要给坐标自定义一些不一样的标记,就可以使用plot()方法的marker参数来定义。
Python由荷兰数学和计算机科学研究学会的Guido van Rossum 于1990 年代初设计,作为一门叫做ABC语言的替代品。 Python提供了高效的高级数据结构,还能简单有效地面向对象编程。Python语法和动态类型,以及解释型语言的本质,使它成为多数平台上写脚本和快速开发应用的编程语言,随着版本的不断更新和语言新功能的添加,逐渐被用于独立的、大型项目的开发。

楼主说的现在很多网站都在用哦----缩略法,好处是不会损害的质量网页为了提高浏览速度很多都在用,是个相当重要的技术
盗链的问题估计是没法解决的,很多做网站的都有"小偷程序",把别人的新闻,等下载下来作为己用防盗用最好的方法就是在上加上水印效果,比如说在图上打上自己的网址等等,就是要让别人知道这个图是你网站上传出去的
C#实现缩略图及水印:
using System;
using SystemIO;
using SystemDrawing;
using SystemDrawingImaging;
public class PictureMarker
{
/// <summary>
/// PictureMarker的构造函数
/// </summary>
public PictureMarker()
{
}
/// <summary>
/// PictureMarker的构造函数
/// </summary>
/// <param name="width">缩略图的宽度</param>
/// <param name="height">缩略图的高度</param>
/// <param name="ismust">是否一定要生成缩略图,推荐为false</param>
public PictureMarker(int width, int height, bool ismust)
{
thiswidth = width;
thisheight = height;
thisismust = ismust;
}
/// <summary>
/// PictureMarker的构造函数
/// </summary>
/// <param name="width">缩略图的宽度</param>
/// <param name="height">缩略图的高度</param>
/// <param name="ismust">是否一定要生成缩略图,推荐为false</param>
/// <param name="isSavePrimaryPic">是否要保存源</param>
/// <param name="primaryPicPath">源的保存目录</param>
public PictureMarker(int width, int height, bool ismust, bool isSavePrimaryPic, string primaryPicPath)
: this(width, height, ismust)
{
thisisSavePrimaryPic = isSavePrimaryPic;
thisprimaryPicPath = primaryPicPath;
}
private int width;
private int height;
private bool ismust = false;
private bool isSavePrimaryPic = false;
private string primaryPicPath;
/// <summary>
/// 缩略图的宽度
/// </summary>
public int Width
{
get { return width; }
set { width = value; }
}
/// <summary>
/// 缩略图的高度
/// </summary>
public int Height
{
get { return height; }
set { height = value; }
}
/// <summary>
/// 是否一定要生成缩略图,推荐为false
/// </summary>
public bool IsMust
{
get { return ismust; }
set { ismust = value; }
}
/// <summary>
/// 是否要保存源
/// </summary>
public bool IsSavePrimaryPic
{
get { return isSavePrimaryPic; }
set { isSavePrimaryPic = value; }
}
/// <summary>
/// 源的保存目录
/// </summary>
public string PrimaryPicPath
{
get { return primaryPicPath; }
set { primaryPicPath = value; }
}
/// <summary>
/// 在上添加版权信息水印
/// </summary>
/// <param name="input">目标</param>
/// <param name="copyright">文字版权信息</param>
/// <param name="savepath">保存路径</param>
/// <param name="position">水印显示位置</param>
public void CreateMark(Stream input, string copyright, string savepath, WaterPosition position)
{
int xpoint, ypoint;
SystemDrawingImage photo = SystemDrawingImageFromStream(input);
int pwidth = photoWidth;
int pheight = photoHeight;
Bitmap markpic = new Bitmap(photo);
markpicSetResolution(photoHorizontalResolution, photoVerticalResolution);
Graphics graphics = GraphicsFromImage(markpic);
xpoint = (pwidth - 100) / 2;
ypoint = pheight - 40;
graphicsDrawString(copyright, new Font("楷体", 15), new SystemDrawingSolidBrush(ColorFromArgb(255, 0, 255, 255)),
new RectangleF(xpoint, ypoint, 400, 30));
try
{
markpicSave(savepath);
}
finally
{
inputClose();
photoDispose();
markpicDispose();
graphicsDispose();
}
}
/// <summary>
/// 在上添加版权信息水印
/// </summary>
/// <param name="input">目标</param>
/// <param name="copyright">版权信息</param>
/// <param name="savepath">保存路径</param>
/// <param name="position">水印显示位置</param>
public void CreateMark(Stream input, Stream copyright, string savepath, WaterPosition position)
{
int xpoint, ypoint;
SystemDrawingImage photo = SystemDrawingImageFromStream(input);
SystemDrawingImage copy = SystemDrawingImageFromStream(copyright);
int pwidth = photoWidth;
int pheight = photoHeight;
int cwidth = copyWidth;
int cheight = copyHeight;
if (pwidth - cwidth < 20 || pheight - cheight < 20)
{
inputClose();
copyrightClose();
photoDispose();
copyDispose();
throw new ArgumentException("不合适的尺寸目标比版权至少宽20像素,高20像素");
}
if (isSavePrimaryPic)
{
if (primaryPicPath == null || primaryPicPath == "")
{
inputClose();
copyrightClose();
photoDispose();
copyDispose();
throw new ArgumentException("当要求保存源时,源的保存路径不能为空");
}
try
{
photoSave(primaryPicPath + "\\" + PathGetFileName(savepath) + "jpg", ImageFormatJpeg);
}
catch (Exception ex)
{
inputClose();
copyrightClose();
photoDispose();
copyDispose();
throw ex;
}
}
Bitmap markpic = new Bitmap(photo);
markpicSetResolution(photoHorizontalResolution, photoVerticalResolution);
Graphics graphics = GraphicsFromImage(markpic);
SystemDrawingImagingImageAttributes att = new SystemDrawingImagingImageAttributes();
float[][] matrixelements = {
new float[] {10f, 00f, 00f, 00f, 00f},
new float[] {00f, 10f, 00f, 00f, 00f},
new float[] {00f, 00f, 10f, 00f, 00f},
new float[] {00f, 00f, 00f, 05f, 00f},
new float[] {00f, 00f, 00f, 00f, 10f}};
SystemDrawingImagingColorMatrix matrix = new SystemDrawingImagingColorMatrix(matrixelements);
attSetColorMatrix(matrix, ColorMatrixFlagDefault, ColorAdjustTypeBitmap);
switch (position)
{
case WaterPositionLeft:
xpoint = 10;
ypoint = (pheight - cheight) / 2;
break;
case WaterPositionLeftUp:
xpoint = 10;
ypoint = 10;
break;
case WaterPositionMiddleUp:
xpoint = (pwidth - cwidth) / 2;
ypoint = 10;
break;
case WaterPositionRightUp:
xpoint = pwidth - cwidth - 10;
ypoint = 10;
break;
case WaterPositionRight:
xpoint = pwidth - cwidth - 10;
ypoint = (pheight - cheight) / 2;
break;
case WaterPositionRightDown:
xpoint = pwidth - cwidth - 10;
ypoint = pheight - cheight - 10;
break;
case WaterPositionMiddleDown:
xpoint = (pwidth - cwidth) / 2;
ypoint = pheight - cheight - 10;
break;
case WaterPositionLeftDown:
xpoint = 10;
ypoint = pheight - cheight - 10;
break;
default:
xpoint = (pwidth - cwidth) / 2;
ypoint = (pheight - cheight) / 2;
break;
};
graphicsDrawImage(copy, new Rectangle(xpoint, ypoint, cwidth, cheight), 0, 0, cwidth, cheight, GraphicsUnitPixel, att);
if (width != 0 && height != 0)
{
if (ismust)
{
int twidth, theight;
if (markpicWidth height > markpicHeight width)
{
twidth = width;
theight = markpicHeight width / markpicWidth;
}
else
{
theight = height;
twidth = markpicWidth height / markpicHeight;
}
markpicSetResolution(twidth, theight);
markpic = (Bitmap)markpicGetThumbnailImage(twidth, theight, null, new IntPtr());
}
else
{
if (width < markpicWidth || height < markpicHeight)
{
if (width < markpicWidth || height < markpicHeight)
{
int twidth, theight;
if (markpicWidth height > markpicHeight width)
{
twidth = width;
theight = markpicHeight width / markpicWidth;
}
else
{
theight = height;
twidth = markpicWidth height / markpicHeight;
}
markpicSetResolution(twidth, theight);
markpic = (Bitmap)markpicGetThumbnailImage(twidth, theight, null, new IntPtr());
}
}
}
}
try
{
markpicSave(savepath, ImageFormatJpeg);
}
finally
{
graphicsDispose();
inputClose();
copyrightClose();
photoDispose();
copyDispose();
markpicDispose();
}
}
/// <summary>
/// 在上添加版权信息水印
/// </summary>
/// <param name="input">目标</param>
/// <param name="copyright">版权信息,可以为路径或文字版权信息</param>
/// <param name="directory">保存目录</param>
/// <param name="filename">保存文件名</param>
/// <param name="isDrectory">copyright是否为文件路径</param>
/// <param name="position">水印显示位置</param>
public void CreateMark(Stream input, string copyright, string directory, string filename, bool isDrectory, WaterPosition position)
{
if (isDrectory)
{
FileStream _copyright = new FileStream(copyright, FileModeOpen, FileAccessRead, FileShareRead);
CreateMark(input, _copyright, directory, filename, position);
}
else
{
CreateMark(input, copyright, directory + "\\" + filename, position);
}
}
/// <summary>
/// 在上添加版权信息水印
/// </summary>
/// <param name="input">目标</param>
/// <param name="copyright">版权信息</param>
/// <param name="directory">保存目录</param>
/// <param name="filename">保存文件名</param>
/// <param name="position">水印显示位置</param>
public void CreateMark(Stream input, Stream copyright, string directory, string filename, WaterPosition position)
{
CreateMark(input, copyright, directory + "\\" + filename, position);
}
/// <summary>
/// 在上添加版权信息水印
/// </summary>
/// <param name="filepath">目标路径</param>
/// <param name="copyright">版权信息,可以为路径或文字版权信息</param>
/// <param name="directory">保存目录</param>
/// <param name="filename">保存文件名</param>
/// <param name="isDrectory">copyright是否为文件路径</param>
/// <param name="position">水印显示位置</param>
public void CreateMark(string filepath, string copyright, string directory, string filename, bool isDrectory, WaterPosition position)
{
FileStream input = new FileStream(filepath, FileModeOpen, FileAccessReadWrite, FileShareRead);
CreateMark(input, copyright, directory, filename, isDrectory, position);
}
/// <summary>
/// 在上添加版权信息水印
/// </summary>
/// <param name="filepath">目标路径</param>
/// <param name="copyright">版权信息,可以为路径或文字版权信息</param>
/// <param name="savepath">保存路径</param>
/// <param name="isDrectory">copyright是否为文件路径</param>
/// <param name="position">水印显示位置</param>
public void CreateMark(string filepath, string copyright, string savepath, bool isDrectory, WaterPosition position)
{
if (isDrectory)
{
FileStream input = new FileStream(filepath, FileModeOpen, FileAccessReadWrite, FileShareRead);
FileStream _copyright = new FileStream(copyright, FileModeOpen, FileAccessRead, FileShareRead);
CreateMark(input, _copyright, savepath, position);
}
else
{
FileStream input = new FileStream(filepath, FileModeOpen, FileAccessReadWrite, FileShareRead);
CreateMark(input, copyright, savepath, position);
}
}
public void CreateThumbnailImage(Stream input, string savepath)
{
if (width == 0 || height == 0)
{
inputClose();
throw new ArgumentException("缩略图的宽度和高度不能为0");
}
Image photo = ImageFromStream(input);
if (isSavePrimaryPic)
{
if (primaryPicPath == null || primaryPicPath == "")
{
inputClose();
photoDispose();
throw new ArgumentException("当要求保存源时,源的保存路径不能为空");
}
try
{
photoSave(PathCombine(primaryPicPath, PathGetFileNameWithoutExtension(savepath) + "jpg"), ImageFormatJpeg);
}
catch (Exception ex)
{
inputClose();
photoDispose();
throw ex;
}
}
Bitmap markpic = new Bitmap(photo);
if (ismust)
{
int twidth, theight;
if (markpicWidth height > markpicHeight width)
{
twidth = width;
theight = markpicHeight width / markpicWidth;
}
else
{
theight = height;
twidth = markpicWidth height / markpicHeight;
}
markpicSetResolution(twidth, theight);
markpic = (Bitmap)markpicGetThumbnailImage(twidth, theight, null, new IntPtr());
}
else
{
if (width < markpicWidth || height < markpicHeight)
{
if (width < markpicWidth || height < markpicHeight)
{
int twidth, theight;
if (markpicWidth height > markpicHeight width)
{
twidth = width;
theight = markpicHeight width / markpicWidth;
}
else
{
theight = height;
twidth = markpicWidth height / markpicHeight;
}
markpicSetResolution(twidth, theight);
markpic = (Bitmap)markpicGetThumbnailImage(twidth, theight, null, new IntPtr());
}
}
}
try
{
markpicSave(savepath, ImageFormatJpeg);
}
finally
{
inputClose();
photoDispose();
markpicDispose();
}
}
public void CreateThumbnailImage(string source, string savepath)
{
FileStream input = new FileStream(source, FileModeOpen, FileAccessReadWrite, FileShareRead);
CreateThumbnailImage(input, savepath);
}
/// <summary>
/// 水印显示的位置
/// </summary>
public enum WaterPosition
{
/// <summary>
/// 左上
/// </summary>
LeftUp,
/// <summary>
/// 中上
/// </summary>
MiddleUp,
/// <summary>
/// 右上
/// </summary>
RightUp,
/// <summary>
/// 右
/// </summary>
Right,
/// <summary>
/// 右下
/// </summary>
RightDown,
/// <summary>
/// 中下
/// </summary>
MiddleDown,
/// <summary>
/// 左下
/// </summary>
LeftDown,
/// <summary>
/// 左
/// </summary>
Left,
/// <summary>
/// 正中间
/// </summary>
Middle
}
}

博凌科为的中分子量蛋白Marker II是由7种蛋白质分别纯化后混合而成的蛋白质溶液,分子量范围为14KD-94KD,经SDS-聚丙烯酰胺凝胶电泳后,用考马斯亮蓝R-250(Coomassie Blue R-250)染色后可得清晰的7条蛋白带。建议使用分离浓度为12%~15%。
*** 作步骤:
1室温融解Marker或37- 40°C 温浴几分钟使之融解,混匀均一,不要高温加热。
2 为避免污染最好分装保存以备使用,取所需体积的Marker置于一干净离心管中并封好口。
3 上样并进行 SDS-PAGE电泳。
4 该Marker适用于考马斯亮蓝, 银染或其他蛋白染色方法。
注意:银染比考马斯亮蓝染色敏感度高10~100 倍,相应的银染需要减少用量。
5 变性蛋白Marker储存于-20°C。
6 在非变性聚丙烯酰胺凝胶电泳中不要使用该Marker,因为在该Marker的储存缓冲液中存在SDS。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13303310.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-11
下一篇 2023-07-11

发表评论

登录后才能评论

评论列表(0条)

保存